Mail Archives: pgcc/1999/10/22/17:41:24
Once I'd tried to use pgcc-1.1.3 to compile mailx for Intel Linux-2.2.x
with glibc2 but the final executable segfaulted on the start while one
compiled with egcs-1.1.2 ran correctly. Now I've checked pgcc-2.95.1 but
the bug is still here. I localized the bug and made the striped example
which looks like that:
------------------------
#include <stdlib.h>
int aa=0x81;
int main(){
short a=aa;
if(a==1)return printf("");
switch(a & (~0x0FF0)){
case 0:printf("2\n");break;
case 1:printf("right\n");break;
case 2:printf("2\n");break;
case 3:printf("3\n");break;
case 4:printf("4\n");break;
default:printf("wrong\n");
}
return 0;
}
--------------------------------
If the example is compiled without optimization the result of execution is
"right", with -O , -O2 - "wrong".
What's especially funny, if the line with the switch statement is replaced
by the seemingly equivalent statement:
switch(a & 0xF00F){
the code is compiled correctly.
All other lines however strange they look are also required for the bug to
show up.
Rimantas Plaipa,
Department of Biochemistry and Biophysics,
Vilnius University,
Ciurlionio 21/27, Vilnius 2009, Lithuania.
E-mail: rp010gf AT voruta DOT vu DOT lt
Phone: (370-2)-650381
Fax: (370-2)-235049
- Raw text -