[Bug c/12636] New: BUG in SH code optimization
NitinY at KPITCummins dot com
gcc-bugzilla@gcc.gnu.org
Thu Oct 16 10:38:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12636
Summary: BUG in SH code optimization
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: NitinY at KPITCummins dot com
CC: gcc-bugs at gcc dot gnu dot org,shrinivasa at
kpitcummins dot com
GCC target triplet: sh-unknown-elf
Hi,
If following code is compiled with and without optimization switches, gives
different results at least for SH ELF compiler.
Command line for execution:-
@echo Compiling With O3 Optimization
sh-elf-gcc test.c -g -m3 -O3 -o opt.out
sh-elf-run opt.out
@echo Compiling Without Optimization
sh-elf-gcc test.c -g -m3 -o wopt.out
sh-elf-run wopt.out
/* ********************** Test.c begin ****************************** */
#include <stdio.h>
typedef struct
{
int number;
char Arr[25];
} aa;
aa st1 = {12, "Sample"};
struct aa * GetPtr ()
{
return NULL;
}
int main ()
{
int a;
aa *ptr1 = NULL;
ptr1 = GetPtr ();
a = ptr1->number;
ptr1->number = 10;
if (!ptr1)
{
printf ("NULL Pointer\n");
}
else
{
printf ("NON NULL String \n");
}
return 1;
}
/* ********************** Test.c end ****************************** */
More information about the Gcc-bugs
mailing list