This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/493: gcc creates incorrect code generated with x ? L"X":L"Y"
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/493: gcc creates incorrect code generated with x ? L"X":L"Y"
- From: chris dot gilbert at citrix dot com
- Date: 29 Aug 2000 18:12:35 -0000
- Reply-To: chris dot gilbert at citrix dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, chris.gilbert@citrix.com
>Number: 493
>Category: c
>Synopsis: gcc creates incorrect code generated with x ? L"X":L"Y"
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Aug 29 11:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: chris.gilbert@citrix.com
>Release: gcc 2.95.2 powerpc and gcc 2.8.1 sparc
>Organization:
>Environment:
aix 4.3.3.0 (powerpc-ibm-aix4.3.3.0)
Solaris 2.6
>Description:
When compiling the attached c code it incorrectly outputs:
X
X
instead of:
Y
X
It seems that the compiler is assuming that the value==1 is always true.
Note that this doesn't happen on gcc 2.8.1 ix86 on solaris 2.7
>How-To-Repeat:
compile code:
$gcc gccifbug.c
$./a.out
X
X
>Fix:
Workaround: replace the ? : block with a proper if {}else {}
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gccifbug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gccifbug.c"
I2luY2x1ZGUgPHdjaGFyLmg+CiNpbmNsdWRlIDxzdGRpby5oPgoKY29uc3Qgd2NoYXJfdCAqIHRl
c3RmdW5jKGludCB2YWx1ZSkgewogICAgcmV0dXJuICgodmFsdWU9PTEpID8gTCJYIjpMIlkiKTsK
fQoKaW50IG1haW4odm9pZCkgewogICAgCiAgICBwcmludGYoIiVTXG4iLCB0ZXN0ZnVuYygwKSk7
CiAgICBwcmludGYoIiVTXG4iLCB0ZXN0ZnVuYygxKSk7CgogICAgcmV0dXJuIDA7Cn0KICAgIAo=