public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44772] New: -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4]
@ 2010-07-01 20:09 lennox at cs dot columbia dot edu
2010-07-13 18:54 ` [Bug c/44772] " lennox at cs dot columbia dot edu
2010-08-11 20:01 ` lennox at cs dot columbia dot edu
0 siblings, 2 replies; 3+ messages in thread
From: lennox at cs dot columbia dot edu @ 2010-07-01 20:09 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4544 bytes --]
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/44772] -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4]
2010-07-01 20:09 [Bug c/44772] New: -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4] lennox at cs dot columbia dot edu
@ 2010-07-13 18:54 ` lennox at cs dot columbia dot edu
2010-08-11 20:01 ` lennox at cs dot columbia dot edu
1 sibling, 0 replies; 3+ messages in thread
From: lennox at cs dot columbia dot edu @ 2010-07-13 18:54 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/44772] -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4]
2010-07-01 20:09 [Bug c/44772] New: -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4] lennox at cs dot columbia dot edu
2010-07-13 18:54 ` [Bug c/44772] " lennox at cs dot columbia dot edu
@ 2010-08-11 20:01 ` lennox at cs dot columbia dot edu
1 sibling, 0 replies; 3+ messages in thread
From: lennox at cs dot columbia dot edu @ 2010-08-11 20:01 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-11 20:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-01 20:09 [Bug c/44772] New: -Wc++-compat warns incorrectly for anonymous unions [regression from 4.4] lennox at cs dot columbia dot edu
2010-07-13 18:54 ` [Bug c/44772] " lennox at cs dot columbia dot edu
2010-08-11 20:01 ` lennox at cs dot columbia dot edu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).