This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12227] New: wrong calling of functions in certain circumstances (see the sample code)
- From: "l_belev at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Sep 2003 17:49:32 -0000
- Subject: [Bug optimization/12227] New: wrong calling of functions in certain circumstances (see the sample code)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12227
Summary: wrong calling of functions in certain circumstances (see
the sample code)
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: l_belev at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
/*
* this sample should print AbCdEf and does it
* when it's compiled with -O0 or -O3, but when
* it's compiled with -O1 or -O2, it incorrectly
* prints ABCDEF. I looked at the generated assembler
* code, and obviously it's erroneous.
* (the external func putchar does not interfere with
* this gcc bug - without it the generated code is bad too)
*/
int lower(int x) { return x + 'a'; }
int upper(int x) { return x + 'A'; }
int main()
{
int k;
for (k = 0; k < 6; k++)
putchar(((k & 1) ? lower : upper)(k));
putchar('\n');
return 0;
}