[opensuse-factory] gcc-c++-4.7 internal compiler error using optimisation

Hello, I have a program which compiles fine on Opensuse 12.1 (gcc 4.6) with and without optimisation. In factory I get an internal compiler error if I use an optimsation level >0 (e.g. -O1). My installed gcc packages: gcc-4.7-1.1.x86_64 gcc47-4.7.0_20120413-2.1.x86_64 gcc47-c++-4.7.0_20120413-2.1.x86_64 gcc-c++-4.7-1.1.x86_64 Compilation output: $ g++ -O2 test.cpp. test.cpp: In function ‘uint8_t* findMarker_bin(uint8_t*, const uint8_t*)’: test.cpp:34:1: internal compiler error: Abgebrochen Please submit a full bug report, with preprocessed source if appropriate. Here is the stripped down program test.cpp: #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <stdint.h> #include <cstdio> static const int marker[] = { 0xAC, 0xDC, 0xAC, 0xDC }; inline static uint8_t *findMarker_bin(uint8_t * curFilePos, const uint8_t * const fileEnd) { for (;;) { if ((*curFilePos == marker[0]) && (*(curFilePos + 1) == marker[1]) && (*(curFilePos + 2) == marker[2]) && (*(curFilePos + 3) == marker[3])) { return curFilePos + 4; } else { curFilePos++; if (curFilePos >= fileEnd - 3) { printf("end of mapped file reached!\n"); return 0; } } } } int main(int argc, char **argv) { uint8_t *curPos=NULL, *endPos=NULL; curPos = findMarker_bin(curPos, endPos); return 0; } Does somebody experience similar problems? Dieter -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

El 30/05/12 14:23, dieter escribió:
ifndef _GNU_SOURCE #define _GNU_SOURCE #endif
#include <stdint.h> #include <cstdio>
static const int marker[] = { 0xAC, 0xDC, 0xAC, 0xDC };
inline static uint8_t *findMarker_bin(uint8_t * curFilePos, const uint8_t * const fileEnd) { for (;;) { if ((*curFilePos == marker[0]) && (*(curFilePos + 1) == marker[1]) && (*(curFilePos + 2) == marker[2]) && (*(curFilePos + 3) == marker[3])) { return curFilePos + 4; } else { curFilePos++; if (curFilePos >= fileEnd - 3) { printf("end of mapped file reached!\n"); return 0; } } } }
int main(int argc, char **argv) { uint8_t *curPos=NULL, *endPos=NULL; curPos = findMarker_bin(curPos, endPos); return 0; }
Your test case does not produce an ICE here... -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On Wed, 30 May 2012 14:44:32 -0400 Cristian Rodríguez <crrodriguez@opensuse.org> wrote:
El 30/05/12 14:23, dieter escribió:
Your test case does not produce an ICE here...
thanks for testing, then it must be some "local problem". Dieter -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

Am 30.05.2012 21:25, schrieb dieter:
On Wed, 30 May 2012 14:44:32 -0400 Cristian Rodríguez <crrodriguez@opensuse.org> wrote:
El 30/05/12 14:23, dieter escribió:
Your test case does not produce an ICE here...
thanks for testing, then it must be some "local problem".
Not necessarily. In the packman buildservice, I see lots of spurious ICE's (they vanish on next build) on Factory / x86_64. Unfortunately, I can't reproduce them. If you hava a case that can be reproduced, just do as the ICE message suggests -- file a bug, with preprocessed source. Best regards, Stefan -- Stefan Seyfried "Dispatch war rocket Ajax to bring back his body!" -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On Wed, 30 May 2012, dieter wrote:
On Wed, 30 May 2012 14:44:32 -0400 Cristian Rodríguez <crrodriguez@opensuse.org> wrote:
El 30/05/12 14:23, dieter escribió:
Your test case does not produce an ICE here...
thanks for testing, then it must be some "local problem".
I bet you are running virtualized using KVM. Richard. -- Richard Guenther <rguenther@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

On Thu, 31 May 2012 10:47:55 +0200 (CEST) Richard Guenther <rguenther@suse.de> wrote:
thanks for testing, then it must be some "local problem".
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM? Dieter -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On Thu, 31 May 2012, dieter wrote:
On Thu, 31 May 2012 10:47:55 +0200 (CEST) Richard Guenther <rguenther@suse.de> wrote:
thanks for testing, then it must be some "local problem".
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM?
It's a know issue with KVM and interaction with GMP. Supply a proper CPU config to KVM - the default ones causes cpuid to spit out impossible values (and gmp abort()s on that). Richard. -- Richard Guenther <rguenther@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

On 31.05.2012 12:32, Richard Guenther wrote:
On Thu, 31 May 2012, dieter wrote:
On Thu, 31 May 2012 10:47:55 +0200 (CEST) Richard Guenther <rguenther@suse.de> wrote:
thanks for testing, then it must be some "local problem".
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM?
It's a know issue with KVM and interaction with GMP. Supply a proper CPU config to KVM - the default ones causes cpuid to spit out impossible values (and gmp abort()s on that).
But why would those cause spurious crashes? This GMP code path aborts every time, no? Greetings, Stephan -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On Thu, 31 May 2012, Stephan Kulow wrote:
On 31.05.2012 12:32, Richard Guenther wrote:
On Thu, 31 May 2012, dieter wrote:
On Thu, 31 May 2012 10:47:55 +0200 (CEST) Richard Guenther <rguenther@suse.de> wrote:
thanks for testing, then it must be some "local problem".
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM?
It's a know issue with KVM and interaction with GMP. Supply a proper CPU config to KVM - the default ones causes cpuid to spit out impossible values (and gmp abort()s on that).
But why would those cause spurious crashes? This GMP code path aborts every time, no?
Yes, and I'm sure it is reproducible. Richard. -- Richard Guenther <rguenther@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

On 31.05.2012 17:09, Richard Guenther wrote:
But why would those cause spurious crashes? This GMP code path aborts every time, no?
Yes, and I'm sure it is reproducible.
Then seife and dieter talk about different issues Greetings, Stephan -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

Am 31.05.2012 17:26, schrieb Stephan Kulow:
On 31.05.2012 17:09, Richard Guenther wrote:
But why would those cause spurious crashes? This GMP code path aborts every time, no?
Yes, and I'm sure it is reproducible.
Then seife and dieter talk about different issues
My issue was a libzypp & friends bug, see https://bugzilla.novell.com/764741 -- Stefan Seyfried "Dispatch war rocket Ajax to bring back his body!" -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On Thu, 31 May 2012 12:32:05 +0200 (CEST) Richard Guenther wrote:
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM?
It's a know issue with KVM and interaction with GMP. Supply a proper CPU config to KVM - the default ones causes cpuid to spit out impossible values (and gmp abort()s on that).
Great hint, thanks! When I specify a CPU (I tried phenom) no ICE happens and the (original) program runs as expected. Without specifying a CPU the ICE was absolutely reproducible, it happened every time when an optimisation level >0 was used. Dieter -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On 05/31/2012 05:51 AM, dieter wrote:
On Thu, 31 May 2012 12:32:05 +0200 (CEST) Richard Guenther wrote:
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM?
It's a know issue with KVM and interaction with GMP. Supply a proper CPU config to KVM - the default ones causes cpuid to spit out impossible values (and gmp abort()s on that).
Great hint, thanks! When I specify a CPU (I tried phenom) no ICE happens and the (original) program runs as expected.
Without specifying a CPU the ICE was absolutely reproducible, it happened every time when an optimisation level>0 was used.
This may be related to https://bugzilla.novell.com/show_bug.cgi?id=760210. In this case, the machine description in gcc was wrong for 4.6 and 4.7. That caused the compiler to generate cmove instructions for CPUs that did not have them. I think the gcc developers had a solution, but so far it has not appeared in Tumbleweed, thus probably not in any other openSUSE version. Larry -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org

On Thu, 31 May 2012, Larry Finger wrote:
On 05/31/2012 05:51 AM, dieter wrote:
On Thu, 31 May 2012 12:32:05 +0200 (CEST) Richard Guenther wrote:
I bet you are running virtualized using KVM.
Richard.
yes, correct - KVM of Opensuse 12.1 with current updates. Can you reproduce it with KVM? Or is it a known issue with KVM?
It's a know issue with KVM and interaction with GMP. Supply a proper CPU config to KVM - the default ones causes cpuid to spit out impossible values (and gmp abort()s on that).
Great hint, thanks! When I specify a CPU (I tried phenom) no ICE happens and the (original) program runs as expected.
Without specifying a CPU the ICE was absolutely reproducible, it happened every time when an optimisation level>0 was used.
This may be related to https://bugzilla.novell.com/show_bug.cgi?id=760210. In this case, the machine description in gcc was wrong for 4.6 and 4.7. That caused the compiler to generate cmove instructions for CPUs that did not have them. I think the gcc developers had a solution, but so far it has not appeared in Tumbleweed, thus probably not in any other openSUSE version.
Though that would get you SIGILL, not SIGABRT. Richard. -- Richard Guenther <rguenther@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
participants (6)
-
Cristian Rodríguez
-
dieter
-
Larry Finger
-
Richard Guenther
-
Stefan Seyfried
-
Stephan Kulow