This is the mail archive of the gcc@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: memcpy / Language Lawyer / optimization question


> From: Joe Buck <Joe.Buck@synopsys.COM>
> On Thu, Dec 09, 2004 at 05:54:08PM -0500, Paul Schlie wrote:
>> As a more general but related question: as C does not define/specify
>> everything, and even occasionally specifies something as being explicitly
>> "unspecified", giving license to the complier to express whatever incidental
>> behavior it may have; has the GCC team adopted the strategy that it will
>> strive to adopt and document the behavior which seems most generally useful
>> and/or least-fragile in such circumstances ... ?
> 
> No, because such a design decision would lead to a compiler that produces
> extremely slow code.  Some programmer might accidentally try to use
> unaligned integers on a processor that does not support unaligned word
> accesses, so your dictum would force the compiler to do all memory
> accesses one byte at a time, just so that this hypothetical programmer can
> continue to write sloppy code.
> 
> If, as a programmer, you follow the language standard, the gcc team will
> immediately accept that any failure to handle your code is a gcc bug.
> Same goes for use of a documented extension in a documented way.  Do
> otherwise, and you are on your own.

> From: Geoffrey Keating <geoffk@geoffk.org>
> No, that strategy has not been adopted.  This avoids arguments about
> what is "most generally useful" or "least-fragile".  What people
> usually mean by such statements is "whatever compiler X does" or
> "whatever the previous version of GCC does" or "this particular
> behaviour that my program expects", and generally you can find
> evidence in that form for many possible behaviours.

Thanks, understood.

-paul-





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