public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64918] New: invalid (?) warning when initializing structure
@ 2015-02-03 13:43 oystein at gnubg dot org
  2015-02-03 15:47 ` [Bug c/64918] " joseph at codesourcery dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: oystein at gnubg dot org @ 2015-02-03 13:43 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 9102 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64918

            Bug ID: 64918
           Summary: invalid (?) warning when initializing structure
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oystein at gnubg dot org

Created attachment 34651
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34651&action=edit
Code that trigger the invalid warning.

Hi!

I'm initializing a complex structure with designated initialisers and
overriding an array element (intentionally), and I then get the error message:

sideffects.c:26:13: warning: initialized field with side-effects overwritten
             [3] = { .func = thefunction, .args = &((char*[]){"foo4", "bar4",
"baz4"})},
             ^
sideffects.c:26:13: warning: (near initialization for 'myconfig.config[3]')

However I do believe my code is correct. It complains about initializing with
side-effects, but I think my code is legal c99. (Please tell me otherwise.)

I compile the attached code with:
gcc -std=gnu99 -Wall -Wextra -Wno-override-init sideeffects.c -o sideeffects

I have tried several different versions of GCC, and here is a short summary:

GCC 4.9.2 (Arch Linux x86_64)  -> Warning generated.
GCC 4.9.2 (Mingw32-w64 x86_64) -> Warning generated.
GCC 4.8.0 (Linux x86_64)       -> Warning generated. 
GCC 4.4.7 (Red Hat 4.4.7-4)    -> No warning.
GCC 4.1.2 (Red Hat 4.1.2-52)   -> No warning.
clang 3.5.1 (Arch Linux)       -> No warning.

Best regards,
-Øystein



Full info on compilers used (Those that generates warning):

[oystein@jupiter ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.9-20141224/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib
--disable-werror --enable-checking=release
Thread model: posix
gcc version 4.9.2 20141224 (prerelease) (GCC)


[14:29:03,90 c:\APPL]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/Program\
Files/mingw-w64/x86_64-4.9.2-posix-seh-rt_v3-rev1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.2/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64
--with-sysroot=/c/mingw492/x86_64-492-posix-seh-rt_v3-rev1/mingw64
--with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared
--enable-static --disable-multilib
--enable-languages=ada,c,c++,fortran,objc,obj-c++,lto
--enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp
--enable-libatomic --enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-libs
--disable-isl-version-check --disable-cloog-version-check
--disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona
--with-tune=core2 --with-libiconv --with-system-zlib
--with-gmp=/c/mingw492/prerequisites/x86_64-w64-mingw32-static
--with-mpfr=/c/mingw492/prerequisites/x86_64-w64-mingw32-static
--with-mpc=/c/mingw492/prerequisites/x86_64-w64-mingw32-static
--with-isl=/c/mingw492/prerequisites/x86_64-w64-mingw32-static
--with-cloog=/c/mingw492/prerequisites/x86_64-w64-mingw32-static
--enable-cloog-backend=isl --with-pkgversion='x86_64-posix-seh-rev1, Built by
MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64
CFLAGS='-O2 -pipe
-I/c/mingw492/x86_64-492-posix-seh-rt_v3-rev1/mingw64/opt/include
-I/c/mingw492/prerequisites/x86_64-zlib-static/include
-I/c/mingw492/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -I/c/mingw492/x86_64-492-posix-seh-rt_v3-rev1/mingw64/opt/include
-I/c/mingw492/prerequisites/x86_64-zlib-static/include
-I/c/mingw492/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=
LDFLAGS='-pipe -L/c/mingw492/x86_64-492-posix-seh-rt_v3-rev1/mingw64/opt/lib
-L/c/mingw492/prerequisites/x86_64-zlib-static/lib
-L/c/mingw492/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 4.9.2 (x86_64-posix-seh-rev1, Built by MinGW-W64 project)

[ojohans@st-linapp30 ~/tmp]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/private/ojohans/personal/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk-source/gcc/configure
--enable-languages=c,c++,fortran --enable-checking=release --disable-bootstrap
--disable-libmudflap --disable-libstdcxx-pch --enable-libgomp --enable-lto
--enable-gold --with-plugin-ld=/usr/bin/gold
--with-cloog-include=/usr/include-cloog --with-cloog-lib=/usr/lib64
--prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.8.0 20121206 (experimental) [trunk revision 194238] (GCC)
>From gcc-bugs-return-475879-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Feb 03 13:47:30 2015
Return-Path: <gcc-bugs-return-475879-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18142 invoked by alias); 3 Feb 2015 13:47:29 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18119 invoked by uid 48); 3 Feb 2015 13:47:26 -0000
From: "tgard at opentext dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/64919] New: bootstrap failure of gcc-4.9.2 on ia64-hpux in libgcc
Date: Tue, 03 Feb 2015 13:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tgard at opentext dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-64919-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg00212.txt.bz2
Content-length: 1604

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd919

            Bug ID: 64919
           Summary: bootstrap failure of gcc-4.9.2 on ia64-hpux in libgcc
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tgard at opentext dot com

Created attachment 34652
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4652&actioníit
The command from config.log which fails

The HPUX version is 11.31
gcc-4.9.2 did not bootstrap using HPUX aCC so I installed gcc-4.7.2 and used
this.

The latest gnu assembler is used as I failed to get gcc-4.7.2 to work.

The error is:
-------------------------------
configure:3389: /builds/gbgbuild/bld/gcc/stbldh01/obj-4.9.2/./gcc/xgcc
-B/builds/gbgbuild/bld/gcc/stbldh01/obj-4.9.2/./gcc/
-B/usr/local/gcc-4.9.2/ia64-hp-hpux11.31/bin/
-B/usr/local/gcc-4.9.2/ia64-hp-hpux11.31/lib/ -isystem
/usr/local/gcc-4.9.2/ia64-hp-hpux11.31/include -isystem
/usr/local/gcc-4.9.2/ia64-hp-hpux11.31/sys-include    -o conftest -g -O2
conftest.c  >&5
conftest.c: In function 'main':
conftest.c:11:1: internal compiler error: Segmentation fault
 main ()
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
....
configure:3620: error: in
`/builds/gbgbuild/bld/gcc/stbldh01/obj-4.9.2/ia64-hp-hpux11.31/libgcc':
configure:3623: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
----------------------------------
See also attachments


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-05 16:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-03 13:43 [Bug c/64918] New: invalid (?) warning when initializing structure oystein at gnubg dot org
2015-02-03 15:47 ` [Bug c/64918] " joseph at codesourcery dot com
2015-02-03 16:38 ` oystein at gnubg dot org
2015-02-03 17:33 ` joseph at codesourcery dot com
2015-04-20 15:14 ` mpolacek at gcc dot gnu.org
2015-04-23 22:44 ` mpolacek at gcc dot gnu.org
2015-04-23 23:33 ` manu at gcc dot gnu.org
2015-05-07 22:15 ` mpolacek at gcc dot gnu.org
2021-01-05 16:57 ` mpolacek at gcc dot gnu.org

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).