This is the mail archive of the gcc-help@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]

Optimizer bug, gcc 4.1.2


Hi,

Program runs fine with no optimization, fails with O3

The essentials (I think) of the offending code:

Static inline int f(char ** ppc);

Int f(char ** ppc) {
  ..
  *ppc = ...
  Return ...
  }

In main:

Unsigned char * pc = NULL;

If (f(&pc) == -1) {
  ..
  } 
Else {
  If (pc) {
    ..
    .. 

Using O3, the test if (pc) always fails because the generated code tests
the value of pc before pc is updated as a result of the function call.

Changing the definition of pc to char * makes the code work properly.

I thought that unsigned char and char were equivalent?

Regards,
Paula Duijneveld 
********************************************************
For information, services and offers, please visit our web site: http://www.klm.com. This e-mail and any attachment may contain confidential and privileged material intended for the addressee only. If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed, and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful. If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message. 

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt. 
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands, with registered number 33014286
********************************************************
			


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