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/12636] New: BUG in SH code optimization


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 ****************************** */


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