This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/16718] New: wrong code-gen for (e1 ?: e2)()


On both gcc versions I have available (tageting x86), I get a seg-fault or
illegal-instruction for this program:

int h() {return 17;}
int g() {(h ?:0)();} // runs fine as (h ? h : 0)()
int main() {g(); return 0;}

I believe this happens whenever (e1 ?: e2) is used as a function argument and e1
is non-zero (haven't tested the case where e1 is 0)

gcc versions (perhaps it's only relevant that the target is x86):

swan% gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
swan% gcc -save-temps blah.c

/cygdrive/y/cyclone$gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,ja
va --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --with
out-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-ve
rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc
-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr
--sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecd
ir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)

-- 
           Summary: wrong code-gen for (e1 ?: e2)()
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: djg at cs dot washington dot edu
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: Redhat (gcc 2.96) and Cygwin (gcc 3.2)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]