[Bug c++/37932] New: narrowing conversion with -std=c++0x
There some confusing/wrong error messages with the -std=c++0x option. All three example statements below work fine without -std=c++0x and with gcc versions <= 4.3. Seems to be a gcc bug and no C++0x demand (at least the first 2 example statements). typedef enum { AA=1, BB=2 } my_enum; typedef struct { my_enum a:4 ; unsigned b:28; } stru; void foo (char c, my_enum x, int i) { char arr[2] = {c+'0', 0}; stru s = {x,0}; stru t = {i,0}; } $ g++ -std=c++0x -c tst.c tst.c: In function 'void foo(char, my_enum, int)': tst.c:7: error: narrowing conversion of '(((int)c) + 48)' to 'char' inside { } tst.c:8: error: narrowing conversion of 'x' to 'unsigned char:4' inside { } tst.c:9: error: narrowing conversion of 'i' to 'unsigned char:4' inside { } gcc trunk rev. 141404 -- Summary: narrowing conversion with -std=c++0x Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37932
[Bug tree-optimization/38169] New: Wrong string constant optimizing
I have found a bug in string constant optimizing in gcc-4.4 trunk. It occurs with -O3 or -O2 -profile-generate (tested on x86_64 and ia64). For C the problem is fixed since rev. 141606, but not for C++. Tested rev. 141852. g++ is okay with non-static function (set -DNO_STATIC): $ ./g++-4.4-141852 -std=c++0x -DNO_STATIC -O3 testutf3.c -o testutf3 && ./testutf3 Test OK g++ -O2 is also okay with static functions: $ ./g++-4.4-141852 -std=c++0x -O2 testutf3.c -o testutf3 && ./testutf3 Test OK g++ is not okay with static functions using -O3 or -O2 -fprofile-generate: $ ./g++-4.4-141852 -std=c++0x -O3 testutf3.c -o testutf3 && ./testutf3 Verify ws failed. Expected: Hello World L Got: 95ad96f8 2a 0 19566cdd0 2ab388 7f9566ca88 2a4003ec 0b408 Verify Us failed. Expected: Hello World U Got: 95579ab0 2a9555d724 2a95579ab0 2a 1 2a 0 0 1 2a 1 Verify ws failed. Expected: HelloWorld s L Got: 95ad96f8 2a 0 19566cdd0 2ab388 7f9566ca88 2a4003ec 0b408 7f Verify Us failed. Expected: HelloWorld s U Got: 95579ab0 2a9555d724 2a95579ab0 2a 1 2a 0 0 1 2a 1 0 Verify ws failed. Expected: HelloWorld L s Got: 95ad96f8 2a 0 19566cdd0 2ab388 7f9566ca88 2a4003ec 0b408 7f Verify Us failed. Expected: HelloWorld U s Got: 95579ab0 2a9555d724 2a95579ab0 2a 1 2a 0 0 1 2a 1 0 Test FAILED. 6 failures occured Aborted Exit 134 (SIGABRT) $ g++-4.4-141852 -std=c++0x -O2 -fprofile-generate testutf3.c -o testutf3 && ./testutf3 Verify ws failed. Expected: Hello World L Got: 604340 09ccb80b1 0403779 040352c 0 b 0402117 09566cdd0 Verify us failed. Expected: Hello World u Got: ca88 9566 2a 0 750 40 0 0 4000 60 0 0 f2e0 Verify Us failed. Expected: Hello World U Got: 604340 095560ef2 2a604328 0 0 0 0 0 0 0402630 Verify ws failed. Expected: HelloWorld s L Got: 604340 09ccb80b1 0403779 040352c 0 b 0402117 09566cdd0 2a Verify us failed. Expected: HelloWorld s u Got: ca88 9566 2a 0 750 40 0 0 4000 60 0 0 f2e0 bfff Verify Us failed. Expected: HelloWorld s U Got: 604340 095560ef2 2a604328 0 0 0 0 0 0 0402630 0 Verify ws failed. Expected: HelloWorld L s Got: 604340 09ccb80b1 0403779 040352c 0 b 0402117 09566cdd0 2a Verify us failed. Expected: HelloWorld u s Got: ca88 9566 2a 0 750 40 0 0 4000 60 0 0 f2e0 bfff Verify Us failed. Expected: HelloWorld U s Got: 604340 095560ef2 2a604328 0 0 0 0 0 0 0402630 0 Verify us failed. Expected: Hello World Got: 6548 6c6c 206f 6f57 6c72 64 0 0 1 0 2a Verify us failed. Expected: Hello World Got: ca88 9566 2a 0 750 40 0 0 4000 60 0 0 Test FAILED. 11 failures occured Aborted Exit 134 (SIGABRT) gcc is okay since trunk rev. 141606 with and non-static functions (set -DNO_STATIC): $ gcc-4.4-141852 -std=gnu99 -DNO_STATIC -O3 testutf3.c -o testutf3 && ./testutf3 Test OK $ gcc-4.4-141852 -std=gnu99 -O3 testutf3.c -o testutf3 && ./testutf3 Test OK gcc old rev. 141605 was not okay: $ gcc-4.4-141605 -std=gnu99 -O3 testutf3.c -o testutf3 && ./testutf3 Verify ws failed. Expected: Hello World L Got:0 0 0 0 05f363878 0 19566cdd0 2ab388 7f9566ca88 Verify Us failed. Expected: Hello World U Got:0 0177ff8e 09556bba0 2a9555d724 2a9556bba0 2a 143545520 0 [...] Test FAILED. 9 failures occured Aborted Exit 134 (SIGABRT) $ gcc-4.4-141605 -std=gnu99 -O2 -fprofile-generate testutf3.c -o testutf3 && ./testutf3 Verify ws failed. Expected: Hello World L Got:0 0 0 0402700 09569dea1 2a604300 09ccb80b1 0403849 Verify us failed. Expected: Hello World u Got: ca88 9566 2a 0 6c8 40 0 0 4000 60 0 0 f2e0 [...] Test FAILED. 13 failures occured Aborted Exit 134 (SIGABRT) -- Summary: Wrong string constant optimizing Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38169
[Bug tree-optimization/38169] Wrong string constant optimizing
--- Comment #1 from holger dot hopp at sap dot com 2008-11-17 13:09 --- Created an attachment (id=16709) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16709&action=view) testcase -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38169
[Bug tree-optimization/38169] Wrong string constant optimizing
--- Comment #4 from holger dot hopp at sap dot com 2008-11-18 11:01 --- Indeed, the newest trunk rev. fixed that issue. Great! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38169
[Bug regression/38200] New: internal compiler error: in find_func_aliases, at tree-ssa-structalias.c:3905
I found following internal compiler error in gcc trunk rev. 142038, maybe a regression of bug 38051 fix. $ gcc-4.4 -O2 -c tst.c tst.c: In function bar2: tst.c:20: internal compiler error: in find_func_aliases, at tree-ssa-structalias.c:3905 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Exit 1 int foo ( void **x ) { return 0; } int (* foo_ptr) ( void **x ) = foo; typedef int ( CALL)(void); typedef CALL *ADR; int foo2 ( ADR * adr ); static int bar ( void ) { int rc; void *ptr; rc = foo2 ( (ADR *)&ptr ); *( (void **) &foo_ptr ) = ptr;; return 0; } void bar2( void ) { int rc = bar(); } -- Summary: internal compiler error: in find_func_aliases, at tree- ssa-structalias.c:3905 Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38200
[Bug regression/38278] New: C++ namespace collision
I've got following namespace collision with gcc trunk rev. 142220. It works for gcc <= 4.3 and trunk rev. <= 142038. $ gcc-4.4 -c tst.c tst.c:8: error: declaration of 'static __number _Numeric_limits_base<__number>::min()' tst.c:2: error: changes meaning of 'min' from 'const _Tp& min(const _Tp&, const _Tp&)' Exit 1 // source: template inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; } template class _Numeric_limits_base { public: static __number ( min)() { return __number(); } }; -- Summary: C++ namespace collision Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38278
[Bug regression/38505] New: internal compiler error: Segmentation fault
testcase produces internal compiler error (SegFault). Error occurs with trunk rev. 142153 ... 142709. Rev. 142038 was ok. $ gcc-4.4 -O2 -c tst.c tst.c: In function 'foo1': tst.c:26: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Exit 1 /* Source: */ typedef long unsigned int size_t; extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); typedef struct { unsigned short a [100]; unsigned short v [20]; unsigned short b [100]; } str_t; extern int foo2 ( int *n ); extern unsigned short bar[]; void foo1 (void) { str_t h; unsigned short * const h_ptr = (unsigned short *) &h; unsigned short h_k[200]; int x; memcpy( h_ptr, h_k, 100 ); memcpy( h.v, bar, 40 ); foo2 (&x); } -- Summary: internal compiler error: Segmentation fault Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38505
[Bug tree-optimization/39202] New: internal compiler error: in collapse_rest_of_var, at tree-ssa-structalias.c:3296
testcase produces internal compiler error: in collapse_rest_of_var, at tree-ssa-structalias.c:3296 Version: trunk rev. 144201. Reproduce: gcc-4.4 -O2 -c tst.c typedef struct { union { int * aaa; } u; } t_a; typedef struct { unsigned bbb : 1; } t_b; typedef struct { int ccc; t_a ddd; t_b eee; int fff; } t_c; typedef struct t_d { t_c f1; t_c f2; } t_d; void foo (void) { t_d ggg; ggg.f1 = ggg.f2; } -- Summary: internal compiler error: in collapse_rest_of_var, at tree-ssa-structalias.c:3296 Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39202
[Bug regression/39214] New: internal compiler error: Segmentation fault
I have an internal compiler error: Segmentation fault with gcc trunk (rev. 144201). In a huge example it occurs in line 440 of gcc/langhooks.c that 'block' is NULL, and that causes this SegFault in 'TREE_CODE (block)'. Instead of shrinking this huge example down, I propose following patch. Can somebody with write access can commit this for me? Index: gcc/langhooks.c === --- gcc/langhooks.c (revision 144201) +++ gcc/langhooks.c (working copy) @@ -437,7 +437,7 @@ while (block && TREE_CODE (block) == BLOCK) block = BLOCK_SUPERCONTEXT (block); - if (TREE_CODE (block) == FUNCTION_DECL) + if (block && TREE_CODE (block) == FUNCTION_DECL) fndecl = block; abstract_origin = NULL; } -- Summary: internal compiler error: Segmentation fault Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39214
[Bug tree-optimization/34029] internal compiler error: verify_stmts failed
--- Comment #1 from holger dot hopp at sap dot com 2007-11-08 13:41 --- Created an attachment (id=14508) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14508&action=view) reproducer -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34029
[Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed
I discovered following internal compiler error in gcc 4.3.0 (trunk). The cause is the svn change 125925. The title sounds to be similar to bug 34018, but the removal of change 125925 does not help for bug 34018. So this bug must be something different. gcc version: gcc 4.3.0 svn revision 125925 and later at least with gcc 4.3.0 svn revision 129958 (20071107). $ gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=...my_path... --enable-shared --with-gmp=...my_path... --with-mpfr=...my_path... --enable-languages=c,c++ Thread model: posix gcc version 4.3.0 20071107 (experimental) (GCC) steps to reproduce: $ gcc -O2 -c testcase.c testcase.c: In function 'checkVersionLibtestcase': testcase.c:10: error: invalid array index 20 - () &version_testcase; testcase.c:10: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Exit 1 Without optimization it compiles fine: $ gcc -c testcase.c Commenting out change 125925 also compiles fine (patch attached). -- Summary: internal compiler error: verify_stmts failed Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34029
[Bug c/35900] New: typecast (sign extension) missing
In the following example the typecast (sign extension) from int (32bit) to long (64bit) is missing. Before the compare the signed i1 is < 0 and unsigned u2 is > 0 and this should be kept when casting to 64bit long. Same issue for long long (also 64bit). So we get correct ov=1 with gcc version <= 4.2, but wrong ov=0 with gcc version >= 4.3. This issue occurs with and without optimization. gcc version: gcc-4_3_branch and trunk svn revision 133752 (gcc-4_2 and below runs fine) int main() { int ov; unsigned u2; int i1; i1 = 0; u2 = (unsigned)2147483647 + 1 ; (i1) += (u2); if ( (long)(i1)<(long)(u2) ) ov = 1; else ov = 0; return !ov; } -- Summary: typecast (sign extension) missing Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35900
[Bug c/35900] typecast (sign extension) missing
--- Comment #2 from holger dot hopp at sap dot com 2008-04-10 16:15 --- You're right! Great - the fix is faster available than expected! Thank you. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35900
[Bug c/36688] New: Incorrect struct assignments with nested const initializers
g++ 4.3 and higher produces incorrect struct assignments with nested constant initializers. In the example, the assignment x = init_x initializes the struct with zero's, not with {{1,2,3},0}. gcc versions: gcc 4.3.2 (svn, 2008/07/01, rev. 137317) gcc 4.4.0 (svn, 2008/06/24) gcc 3.3.3 and gcc 4.1.2 (SuSE) are running fine. systems: x86_64, ia64 (probably platform independent) command line: g++ -O0 t.c (occurs with and without optimizations) preprocessed file: typedef long unsigned int size_t; extern "C" int memcmp (__const void *__s1, __const void *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); typedef struct { long long a; long long b; long long c; } t_bar; typedef struct { t_bar g; long long free[12]; } t_foo; static const t_bar init_y = {1,2,3}; static const t_foo init_x = {init_y,0}; int main () { t_foo x = init_x; return memcmp (&x, &init_x, sizeof(t_foo)); } -- Summary: Incorrect struct assignments with nested const initializers Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36688
[Bug c++/37682] New: g++ internal error: verify_gimple failed
With current trunk (rev. 140784) I get following internal error (g++ only). The error message is similar to bug 37418. Maybe it's the same problem, but maybe it's not. $ /holger/gcc/gnu/trunk/install/bin/g++ -c t.c t.c: In function unsigned int bar(unsigned int, const void*, RefId): t.c:9: error: non-trivial conversion at assignment unsigned int const iftmp.0 = refId.refSector; t.c:9: error: non-trivial conversion at assignment unsigned int iftmp.0 = refPtr->refSector; t.c:9: internal compiler error: verify_gimple failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Exit 1 Source: typedef struct { unsigned refKind : 8; unsigned refSector : 24; } RefId; unsigned foo (const unsigned x); unsigned bar (const int cond, const RefId * const refPtr, const RefId refId) { return foo ( cond ? ((refId).refSector) : ((*refPtr).refSector) ); } -- Summary: g++ internal error: verify_gimple failed Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: holger dot hopp at sap dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37682