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]

RE: optimization/8537: Optimizer Removes Code Necessary for Security


Direct quote from:
http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Bug-Criteria.html

"If the compiler produces valid assembly code that does not correctly
execute the input source code, that is a compiler bug."

So to all you naysayers out there who claim this is a programming error
or poor coding, YES, IT IS A BUG!

From:
http://gcc.gnu.org/ml/gcc/2002-01/msg00518.html

> The problem is the standard gives wide latitude in what the optimizer
can optimize

Isn't this also the solution?  Can't the optimizer check to see if the
function is memset(), and if so check to see if the value is 0 or NULL,
and if so leave it in?

The optimizer could check if memset() is zeroing out memory by checking
if the fill value is 0 or NULL.  If the fill value is 0 or NULL, the
optimizer can reasonably presume that this instance of memset() is for
security and not optimize it out.

Joseph Wagner

-----Original Message-----
From: fw@gcc.gnu.org [mailto:fw@gcc.gnu.org] 
Sent: Sunday, November 17, 2002 8:28 AM
To: gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org;
wagnerjd@prodigy.net
Subject: Re: optimization/8537: Optimizer Removes Code Necessary for
Security

Synopsis: Optimizer Removes Code Necessary for Security

State-Changed-From-To: open->closed
State-Changed-By: fw
State-Changed-When: Sun Nov 17 06:28:05 2002
State-Changed-Why:
    This is not a bug in GCC.  The call to memset() clear hasn't any
externally visible effect according to the C language specification, so
it can be removed by the optimizer.
    
    See the discussion around
http://gcc.gnu.org/ml/gcc/2002-01/msg00518.html for additional
information on a very similar topic.
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=g
cc&pr=8537


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