[Bug c/44772] -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4]
--- Comment #2 from lennox at cs dot columbia dot edu 2010-08-11 20:01 --- This problem still exists in GCC 4.5.1. -- lennox at cs dot columbia dot edu changed: What|Removed |Added Version|4.5.0 |4.5.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44772
[Bug c/44772] -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4]
--- Comment #1 from lennox at cs dot columbia dot edu 2010-07-13 18:54 --- Adding Cc: of Ian Taylor -- this message is emitted by warn_cxx_compat_finish_struct, written by him. -- lennox at cs dot columbia dot edu changed: What|Removed |Added CC||iant at google dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44772
[Bug c/44772] New: -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4]
In GCC 4.5.0, the -Wc++-compat option prints a warning for anonymous unions in C code, even though this code is correct C++ and is accepted by G++. This is a regression from GCC 4.4. $ gcc-4.5 -Wc++-compat -save-temps -c anon-union.c anon-union.c:15:2: warning: using ({anonymous}) as both field and typedef name is invalid in C++ $ g++-4.5 -Wall -save-temps -c anon-union.c [no error] $ gcc-4.4 -Wc++-compat -save-temps -c anon-union.c [no error] $ cat anon-union.c typedef enum { union_type_1, union_type_2 } union_discriminator; typedef struct { union_discriminator discriminator; union { int type1; char* type2; }; } struct_with_anon_union; struct_with_anon_union foo; $ gcc-4.5 -Wc++-compat -save-temps -v -c anon-union.c Using built-in specs. COLLECT_GCC=/home/jonathan/GCC/FSF/bin/gcc-4.5 COLLECT_LTO_WRAPPER=/home/jonathan/GCC/FSF/libexec/gcc/i486-linux-gnu/4.5.0/lto-wrapper Target: i486-linux-gnu Configured with: ../gcc-4.5.0/configure --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/home/jonathan/GCC/FSF --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/home/jonathan/GCC/FSF/include/c++/4.5 --program-suffix=-4.5 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.5.0 (GCC) COLLECT_GCC_OPTIONS='-Wc++-compat' '-save-temps' '-v' '-c' '-mtune=generic' '-march=i486' /home/jonathan/GCC/FSF/libexec/gcc/i486-linux-gnu/4.5.0/cc1 -E -quiet -v anon-union.c -mtune=generic -march=i486 -Wc++-compat -fpch-preprocess -o anon-union.i ignoring nonexistent directory "/home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/../../../../i486-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /home/jonathan/GCC/FSF/include /home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/include /home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-Wc++-compat' '-save-temps' '-v' '-c' '-mtune=generic' '-march=i486' /home/jonathan/GCC/FSF/libexec/gcc/i486-linux-gnu/4.5.0/cc1 -fpreprocessed anon-union.i -quiet -dumpbase anon-union.c -mtune=generic -march=i486 -auxbase anon-union -Wc++-compat -version -o anon-union.s GNU C (GCC) version 4.5.0 (i486-linux-gnu) compiled by GNU C version 4.5.0, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C (GCC) version 4.5.0 (i486-linux-gnu) compiled by GNU C version 4.5.0, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: cef540cf95bd7b1d645fe58566717d69 anon-union.c:15:2: warning: using ({anonymous}) as both field and typedef name is invalid in C++ COLLECT_GCC_OPTIONS='-Wc++-compat' '-save-temps' '-v' '-c' '-mtune=generic' '-march=i486' as -V -Qy --32 -o anon-union.o anon-union.s GNU assembler version 2.20 (i486-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.20 COMPILER_PATH=/home/jonathan/GCC/FSF/libexec/gcc/i486-linux-gnu/4.5.0/:/home/jonathan/GCC/FSF/libexec/gcc/i486-linux-gnu/4.5.0/:/home/jonathan/GCC/FSF/libexec/gcc/i486-linux-gnu/:/home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/:/home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/ LIBRARY_PATH=/home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/:/home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/home/jonathan/GCC/FSF/lib/gcc/i486-linux-gnu/4.5.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-Wc++-compat' '-save-temps' '-v' '-c' '-mtune=generic' '-march=i486' -- Summary: -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4] Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lennox at cs dot columbia dot edu GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44772
[Bug target/42951] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #2 from lennox at cs dot columbia dot edu 2010-02-25 15:31 --- Note that (as with PR 34000) this appears to be a regression from GCC 4.2. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42951
[Bug target/42951] New: GCC pedwarns about use of static inline functions from system headers in extern inline functions
GCC 4.3 prints an unsuppressable warning about any use of a static inline function in a non-static inline function. This includes static inline functions in GCC's own target-specific extra_headers header files. For example, this short file uses the ARM/NEON intrinsics functions defined in arm_neon.h: #include extern inline uint8x8_t vect_add(uint8x8_t a, uint8x8_t b) { return vadd_u8(a, b); } $ arm-linux-gnueabi-gcc -mfpu=neon -c inline-test-neon.c inline-test-neon.c: In function 'vect_add': inline-test-neon.c:5: warning: 'vadd_u8' is static but used in inline function 'vect_add' which is not static The example uses gnu_inline style inlining, but the same thing happens with C99-style inlining if "extern inline" is changed to "inline". PR 34000 fixed this problem for x86 targets (the *mmintrin.h files), but the problem persists for other targets. In particular, the following header files mentioned in extra_targets lines in config.gcc still have static inline functions: arm/arm_neon.h arm/mmintrin.h i386/cpuid.h mips/loongson.h rs6000/ppu_intrinsics.h rs6000/si2vmx.h rs6000/spe.h rs6000/spu2vmx.h sh/ushmedia.h spu/spu_internals.h spu/spu_mfcio.h spu/vmx2spu.h PR 34000's fix, of changing "static __inline void __attribute__((__always_inline__, __artificial__))" to "extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))", should work for the other targets as well. Full gcc -v output: $ arm-linux-gnueabi-gcc -v -mfpu=neon -c inline-test-neon.c Using built-in specs. Target: arm-linux-gnueabi Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.2-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.4-armel/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.4.2 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv7-a --with-tune=cortex-a8 --with-float=softfp --with-fpu=vfp --disable-werror --enable-checking=release --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib --build=i486-linux-gnu --host=i486-linux-gnu --target=arm-linux-gnueabi Thread model: posix gcc version 4.4.2 (Ubuntu 4.4.2-1ubuntu1) COLLECT_GCC_OPTIONS='-v' '-mfpu=neon' '-c' '-march=armv7-a' '-mtune=cortex-a8' '-mfloat-abi=softfp' /usr/lib/gcc/arm-linux-gnueabi/4.4.2/cc1 -quiet -v inline-test-neon.c -quiet -dumpbase inline-test-neon.c -mfpu=neon -march=armv7-a -mtune=cortex-a8 -mfloat-abi=softfp -auxbase inline-test-neon -version -o /tmp/ccWFWFb1.s ignoring duplicate directory "/usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/arm-linux-gnueabi/4.4.2/include /usr/lib/gcc/arm-linux-gnueabi/4.4.2/include-fixed /usr/arm-linux-gnueabi/include End of search list. GNU C (Ubuntu 4.4.2-1ubuntu1) version 4.4.2 (arm-linux-gnueabi) compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version 2.4.1-p2. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: eb94b7d3ec6a4a03406c63875e22eff0 inline-test-neon.c: In function 'vect_add': inline-test-neon.c:5: warning: 'vadd_u8' is static but used in inline function 'vect_add' which is not static COLLECT_GCC_OPTIONS='-v' '-mfpu=neon' '-c' '-march=armv7-a' '-mtune=cortex-a8' '-mfloat-abi=softfp' /usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/bin/as -march=armv7-a -mfloat-abi=softfp -mfpu=neon -meabi=5 -o inline-test-neon.o /tmp/ccWFWFb1.s COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/bin/ LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/lib/ COLLECT_GCC_OPTIONS='-v' '-mfpu=neon' '-c' '-march=armv7-a' '-mtune=cortex-a8' '-mfloat-abi=softfp' -- Summary: GCC pedwarns about use of static inline functions from system headers in extern inline functions Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lennox at cs dot columbia dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: arm-linux-gnueabi http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42951
[Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
--- Comment #7 from lennox at cs dot columbia dot edu 2008-08-11 14:11 --- The fact that the function returns the vector is not an essential part of the test; the return value of the load function just needs not to be optimized out as unused. So changing the test for broader compatibility is fine as far as I'm concerned. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37042
[Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
The Intel SSE intrinsic function _mm_load_si128 prints a warning when the data being loaded from is actually an array of int16_t, even though its argument (__m128i*) is declared with __attribute__((__may_alias__)). $ cat alias-warn-emmintrin.c #include #include static const int16_t __attribute__((__aligned__(16))) tbl[8] = { 1, 2, 3, 4, 5, 6, 7, 8}; __m128i get_vec(void) { __m128i ret; ret = _mm_load_si128((__m128i *)tbl); return ret; } $ ~/GCC/bin/gcc-4.3 -O2 -Wall -msse2 -c alias-warn-emmintrin.c alias-warn-emmintrin.c: In function get_vec: alias-warn-emmintrin.c:12: warning: likely type-punning may break strict-aliasing rules: object *{unknown} of main type long long int __vector__ is referenced at or around /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include/emmintrin.h:681 and may be aliased to object tbl of main type short int which is referenced at or around alias-warn-emmintrin.c:12. $ ~/GCC/bin/gcc-4.3 -v -O2 -Wall -msse2 -c alias-warn-emmintrin.c Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.3-20080731/configure --enable-threads=posix --prefix=/home/jonathan/GCC --with-local-prefix=/usr/local --enable-languages=c,c++,objc,fortran,obj-c++,java --enable-checking=release --enable-ssp --disable-libssp --disable-libgcj --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --program-suffix=-4.3 --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic Thread model: posix gcc version 4.3.2 20080731 (prerelease) (GCC) COLLECT_GCC_OPTIONS='-v' '-O2' '-Wall' '-msse2' '-c' '-mtune=generic' /mnt/int_drive/jonathan/GCC/bin/../libexec/gcc/i686-pc-linux-gnu/4.3.2/cc1 -quiet -v -iprefix /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/ alias-warn-emmintrin.c -quiet -dumpbase alias-warn-emmintrin.c -msse2 -mtune=generic -auxbase alias-warn-emmintrin -O2 -Wall -version -o /tmp/ccKGNLjp.s ignoring nonexistent directory "/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/include" ignoring duplicate directory "/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.2/include" ignoring duplicate directory "/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed" ignoring nonexistent directory "/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed /usr/local/include /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../include /usr/include End of search list. GNU C (GCC) version 4.3.2 20080731 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 4.3.2 20080731 (prerelease), GMP version 4.2.1, MPFR version 2.2.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 3f9a15ebf1f37358d0142d31f7849434 alias-warn-emmintrin.c: In function get_vec: alias-warn-emmintrin.c:12: warning: likely type-punning may break strict-aliasing rules: object *{unknown} of main type long long int __vector__ is referenced at or around /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include/emmintrin.h:681 and may be aliased to object tbl of main type short int which is referenced at or around alias-warn-emmintrin.c:12. COLLECT_GCC_OPTIONS='-v' '-O2' '-Wall' '-msse2' '-c' '-mtune=generic' as -V -Qy -o alias-warn-emmintrin.o /tmp/ccKGNLjp.s GNU assembler version 2.17.50 (i586-suse-linux) using BFD version (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux) COMPILER_PATH=/mnt/int_drive/jonathan/GCC/bin/../libexec/gcc/i686-pc-linux-gnu/4.3.2/:/mnt/int_drive/jonathan/GCC/bin/../libexec/gcc/ LIBRARY_PATH=/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/:/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/:/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-O2' '-Wall' '-msse2' '-c' '-mtune=generic' -- Summary: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)). Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lennox at cs dot columbia dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37042
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #18 from lennox at cs dot columbia dot edu 2008-02-20 05:03 --- This is a regression from 4.2, despite the lack of marking. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #16 from lennox at cs dot columbia dot edu 2008-02-19 21:01 --- Is there any possibility of getting a fix for this into 4.3.0? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #15 from lennox at cs dot columbia dot edu 2008-02-13 22:27 --- Arguably, the use of static data (possible excepting const static data) or a non-inline static function is worthy of a pedwarn. But I'd certainly be inclined to agree for static inline functions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #13 from lennox at cs dot columbia dot edu 2008-02-13 04:38 --- Linking when the functions can't be inlined would be the only gotcha, but that would mean that the new attachment (func-pointer-sse.c) would regress. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #12 from lennox at cs dot columbia dot edu 2008-02-13 04:35 --- Created an attachment (id=15134) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15134&action=view) test program using pointers to functions from emmintrin.h -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #10 from lennox at cs dot columbia dot edu 2008-02-12 22:46 --- The right answer is probably to declare the system header functions "inline" when __GNUC_STDC_INLINE__, otherwise "extern inline"; or equivalently to declare them "extern inline __attribute__((__gnu_inline__))". You then need to provide an out-of-line definition in the appropriate system library, e.g. libgcc for the mmintrin functions. Note that even if you declare the function with __attribute__((__always_inline__)), there are uses that require a non-inlined version of the function, e.g. pointer-to-function. This is the main reason why it's not practical for fixincludes to do this transformation on system headers. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug target/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #8 from lennox at cs dot columbia dot edu 2008-02-12 21:37 --- The attachment (inline-test-sse.c) on this PR is the gnu89 version of the problem. On MacOS X 10.5.2 (Apple gcc 5465), which has the same code as mainline FSF GCC, it prints: inline-test-sse.c: In function 'vect_add': inline-test-sse.c:5: warning: '_mm_add_epi8' is static but used in inline function 'vect_add' which is not static -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug c/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #6 from lennox at cs dot columbia dot edu 2008-02-12 15:49 --- (In reply to comment #4) The problem occurs equally with gnu89 "extern inline" functions as with c99 "inline" functions (as seen in the initial bug report), so using static inline when !__GNUC_STDC_INLINE__ still leaves the problem. -- lennox at cs dot columbia dot edu changed: What|Removed |Added Component|target |c http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug c/34000] GCC pedwarns about use of static inline functions from system headers in extern inline functions
--- Comment #3 from lennox at cs dot columbia dot edu 2008-02-11 19:51 --- A discussion on comp.std.c <http://groups.google.com/group/comp.std.c/browse_thread/thread/8118ae4c53a4de60> indicates that this is indeed a constraint violation; the poster thinks that system headers should be fixed. I don't think it would be possible to write a fixincludes fix to turn static inlines into GNU89 or C99 extern inlines, however, so I think suppressing the pedwarn for system headers is the best option. -- lennox at cs dot columbia dot edu changed: What|Removed |Added Summary|GCC pedwarns about use of |GCC pedwarns about use of |static inline functions in |static inline functions from |extern inline functions |system headers in extern ||inline functions http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug c/34000] GCC pedwarns about use of static inline functions in extern inline functions
--- Comment #2 from lennox at cs dot columbia dot edu 2008-01-30 18:28 --- Created an attachment (id=15058) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15058&action=view) test program illustrating the warning about static inline functions, using emmintrin.h -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug c/34000] GCC pedwarns about use of static inline functions in extern inline functions
--- Comment #1 from lennox at cs dot columbia dot edu 2008-01-30 18:26 --- The static const data problem is also PR 35017, now fixed; I'm editing the summary accordingly. The problem with static inline functions is not restricted to Darwin. The following example shows the problem on any X86 platform with SSE enabled, because the MMX/SSE intrinsic functions in GCC's <*mmintrin.h> headers are defined as static inline functions. This is a regression from GCC 4.2. $ ~/GCC/bin/gcc -msse2 -c inline-test-sse.c inline-test-sse.c: In function vect_add: inline-test-sse.c:5: warning: _mm_add_epi8 is static but used in inline function vect_add which is not static $ ~/GCC/bin/gcc -v -msse2 -c inline-test-sse.c Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.3-20080125/configure --prefix=/home/jonathan/GCC Thread model: posix gcc version 4.3.0 20080125 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-msse2' '-c' '-mtune=generic' /home/jonathan/GCC/libexec/gcc/i686-pc-linux-gnu/4.3.0/cc1 -quiet -v inline-test-sse.c -quiet -dumpbase inline-test-sse.c -msse2 -mtune=generic -auxbase inline-test-sse -version -o /tmp/ccuQGUgc.s ignoring nonexistent directory "/home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /home/jonathan/GCC/include /home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/4.3.0/include /home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/4.3.0/include-fixed /usr/include End of search list. GNU C (GCC) version 4.3.0 20080125 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.3.0 20080125 (experimental), GMP version 4.2.1, MPFR version 2.2.1. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 531c82c665c608438f0d85483de1c151 inline-test-sse.c: In function vect_add: inline-test-sse.c:5: warning: _mm_add_epi8 is static but used in inline function vect_add which is not static COLLECT_GCC_OPTIONS='-v' '-msse2' '-c' '-mtune=generic' as -V -Qy -o inline-test-sse.o /tmp/ccuQGUgc.s GNU assembler version 2.17.50 (i586-suse-linux) using BFD version (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux) COMPILER_PATH=/home/jonathan/GCC/libexec/gcc/i686-pc-linux-gnu/4.3.0/:/home/jonathan/GCC/libexec/gcc/i686-pc-linux-gnu/4.3.0/:/home/jonathan/GCC/libexec/gcc/i686-pc-linux-gnu/:/home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/4.3.0/:/home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/ LIBRARY_PATH=/home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/4.3.0/:/home/jonathan/GCC/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-msse2' '-c' '-mtune=generic' -- lennox at cs dot columbia dot edu changed: What|Removed |Added Summary|GCC pedwarns about use of |GCC pedwarns about use of |static inline functions or |static inline functions in |static const data in extern |extern inline functions |inline functions| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug c/34000] New: GCC pedwarns about use of static inline functions or static const data in extern inline functions
evision 118356, a fix for PR 11377. GCC 4.2 does not have this problem. -- Summary: GCC pedwarns about use of static inline functions or static const data in extern inline functions Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lennox at cs dot columbia dot edu GCC build triplet: i686-apple-darwin9 GCC host triplet: i686-apple-darwin9 GCC target triplet: i686-apple-darwin9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34000
[Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
--- Comment #2 from lennox at cs dot columbia dot edu 2005-12-06 21:31 --- Created an attachment (id=10427) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10427&action=view) Custom debug allocator, based on libstdc++'s malloc_allocator. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
[Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
--- Comment #1 from lennox at cs dot columbia dot edu 2005-12-06 21:30 --- Created an attachment (id=10426) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10426&action=view) C source file, constructing a list with a custom debug allocator. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
[Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown
According to section 23.2.2.3 [lib.list.modifiers] of the C++ specification, for all the insert member functions of std::list, "If an exception is thrown there are no effects." However, this doesn't appear to be the case for libstdc++. It's possible for an exception to be thrown out of an insert() function (e.g. bad_alloc from an allocator) and still have the list change. $ g++40 -v -g -O2 -Wall debug_allocate.cpp -o debug_allocate Using built-in specs. Target: i386-portbld-freebsd5.4 Configured with: ./..//gcc-4.0-20050929/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=40 --libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3 --with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++/ --with-gmp=/usr/local --disable-shared --prefix=/usr/local i386-portbld-freebsd5.4 Thread model: posix gcc version 4.0.3 20050928 (prerelease) [FreeBSD] /usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.3/cc1plus -quiet -v debug_allocate.cpp -quiet -dumpbase debug_allocate.cpp -auxbase debug_allocate -g -O2 -Wall -version -o /var/tmp//cc9cvkJd.s ignoring nonexistent directory "/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/../../../../i386-portbld-freebsd5.4/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++/ /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++//i386-portbld-freebsd5.4 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++//backward /usr/local/include /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/include /usr/include End of search list. GNU C++ version 4.0.3 20050928 (prerelease) [FreeBSD] (i386-portbld-freebsd5.4) compiled by GNU C version 4.0.3 20050928 (prerelease) [FreeBSD]. GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129460 as -o /var/tmp//ccljCm8j.o /var/tmp//cc9cvkJd.s /usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.3/collect2 -V -dynamic-linker /usr/libexec/ld-elf.so.1 -o debug_allocate /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/crtbegin.o -L/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3 -L/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/../../.. /var/tmp//ccljCm8j.o -lstdc++ -lm -lgcc -lc -lgcc /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/crtend.o /usr/lib/crtn.o GNU ld version 2.15 [FreeBSD] 2004-05-23 Supported emulations: elf_i386_fbsd $ ./debug_allocate Caught exception: St9bad_alloc List size: 5 (I'll attach the test programs immediately after submitting the bug.) -- Summary: std::list insert members should have no effects if an exception is thrown Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lennox at cs dot columbia dot edu GCC build triplet: i386-portbld-freebsd5.4 GCC host triplet: i386-portbld-freebsd5.4 GCC target triplet: i386-portbld-freebsd5.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
[Bug tree-optimization/23563] False warning for uninitialized variable: regression from 3.4.2
--- Additional Comments From lennox at cs dot columbia dot edu 2005-08-25 17:23 --- Created an attachment (id=9585) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9585&action=view) C++ source file that produces warning with GCC 4.0.2 This file does not #include any files, so I'm providing the .cpp not the .ii. The preprocessed file is identical except for whitespace and preprocessor-inserted line markers. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23563
[Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2
When I compile warn-thing.cpp (to be attached as soon as I've submitted this bug) with gcc 4.0.2, I get the warning message warn-thing.cpp:24: warning: 'variable' may be used uninitialized in this function This warning appears to me to be incorrect, and did not occur with gcc 3.4.2. The warning does not occur if optimization is not enabled. The attached error output is from gcc version 4.0.2 20050728 (prerelease) [FreeBSD] for i386-portbld-freebsd5.4, but I see the same results with gcc version 4.0.2 20050806 (prerelease) (Debian 4.0.1-4) for i486-linux-gnu. $ gcc40 -v -Wall -O2 -c warn-thing.cpp Using built-in specs. Target: i386-portbld-freebsd5.4 Configured with: ./..//gcc-4.0-20050728/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=40 --libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2 --with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++/ --with-gmp=/usr/local --disable-shared --prefix=/usr/local i386-portbld-freebsd5.4 Thread model: posix gcc version 4.0.2 20050728 (prerelease) [FreeBSD] /usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.2/cc1plus -quiet -v warn-thing.cpp -quiet -dumpbase warn-thing.cpp -auxbase warn-thing -O2 -Wall -version -o /var/tmp//ccjEgsIS.s ignoring nonexistent directory "/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/gcc/i386-portbld-freebsd5.4/4.0.2/../../../../i386-portbld-freebsd5.4/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++/ /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++//i386-portbld-freebsd5.4 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++//backward /usr/local/include /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/gcc/i386-portbld-freebsd5.4/4.0.2/include /usr/include End of search list. GNU C++ version 4.0.2 20050728 (prerelease) [FreeBSD] (i386-portbld-freebsd5.4) compiled by GNU C version 4.0.2 20050728 (prerelease) [FreeBSD]. GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129460 warn-thing.cpp: In function 'void foo()': warn-thing.cpp:24: warning: 'variable' may be used uninitialized in this function as -o warn-thing.o /var/tmp//ccjEgsIS.s For comparison, here is the non-warning output of gcc 3.4: $ gcc -v -Wall -O2 -c warn-thing.cpp Using built-in specs. Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 3.4.2 [FreeBSD] 20040728 /usr/libexec/cc1plus -quiet -v -D_LONGLONG warn-thing.cpp -quiet -dumpbase warn-thing.cpp -auxbase warn-thing -O2 -Wall -version -o /var/tmp//ccHHC2rw.s ignoring duplicate directory "/usr/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/3.4 /usr/include/c++/3.4/backward /usr/include End of search list. GNU C++ version 3.4.2 [FreeBSD] 20040728 (i386-fbsdproj-freebsd) compiled by GNU C version 3.4.2 [FreeBSD] 20040728. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 /usr/bin/as -v -o warn-thing.o /var/tmp//ccHHC2rw.s GNU assembler version 2.15 [FreeBSD] 2004-05-23 (i386-obrien-freebsd) using BFD version 2.15 [FreeBSD] 2004-05-23 -- Summary: False warning for uninitialized variable: regression from 3.4.2 Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lennox at cs dot columbia dot edu CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-portbld-freebsd5.4 GCC host triplet: i386-portbld-freebsd5.4 GCC target triplet: i386-portbld-freebsd5.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23563