public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46921] New: Dropped side effect with combination of statement expression and struct initializer
@ 2010-12-13 13:51 adam at chlipala dot net
  0 siblings, 0 replies; only message in thread
From: adam at chlipala dot net @ 2010-12-13 13:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46921

           Summary: Dropped side effect with combination of statement
                    expression and struct initializer
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: adam@chlipala.net


Created attachment 22740
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22740
Preprocessed C source

A simple example prints only one line of text, where I would expect two, from
my understanding of GCC C semantics.

I've attached the preprocessed source.  Here's the starting point, followed by
the compilation command line and its output.  (A few others reproduced the
behavior on other platforms, including OS X and Ubuntu.)

#include <stdio.h>

typedef struct __uws_0 { } uw_unit;
uw_unit uw_unit_v = {};

struct __uws_1 {
  struct __uws_0 __uwf_1;
  struct __uws_1* __uwf_2;
};

int main() {
  uw_unit uu = ({
      struct __uws_1 tmp =
        {(printf("Inner\n"), uw_unit_v)};
      printf("Outer\n");
      uw_unit_v;
    });

  return 0;
}

// Begin compilation

gcc -v -save-temps test.c -o test

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-6'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --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/include/c++/4.4 --libdir=/usr/lib --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-6) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'test' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/cc1 -E -quiet -v test.c -mtune=generic
-fpch-preprocess -o test.i
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include
 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'test' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/cc1 -fpreprocessed test.i -quiet -dumpbase
test.c -mtune=generic -auxbase test -version -o test.s
GNU C (Debian 4.4.5-6) version 4.4.5 (x86_64-linux-gnu)
    compiled by GNU C version 4.4.5, GMP version 4.3.2, MPFR version 3.0.0-p3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: f5a9f2bad40e3d067f57cd235385ea69
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'test' '-mtune=generic'
 as -V -Qy -o test.o test.s
GNU assembler version 2.20.1 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Debian) 2.20.1-system.20100303
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'test' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/collect2 --build-id --eh-frame-hdr -m
elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
test /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.4.5 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5
-L/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../.. test.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crtn.o


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-13 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-13 13:51 [Bug c/46921] New: Dropped side effect with combination of statement expression and struct initializer adam at chlipala dot net

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