[lkml]   [1996]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: gcc 2.7.2 common subexpression bug with possible kernel imp
> This is a classical aliasing situation; you are modifying *p
> indirectly via buf. I think almost every compiler assumes
> "no-pointer-aliasing" when optimizing; otherwise it's very hard to
> optimize.

No, I certainly hope that no compiler makes any such assumption at all: if they
did they couldn't be called C compilers, but maybe "a language almost, but not
exactly C compilers".

The behaviour Tom May sees would _definitely_ be a compiler bug. Gcc has had
those before when it comes to inline assembly. The documentation clearly states
that "memory" in an assembly statement means that the asm statement changes
memory, so if gc optimizes away the test, it's a bug.

There has been talk about extending the C language so that you could tell the
compiler about aliasing stuff, but it's not there yet (and the extensions have
all been cases where you have to _tell_ the compiler that there are no aliases,
not a question of the compiler assuming it regardless of the user)


 \ /
  Last update: 2005-03-22 13:37    [W:0.023 / U:6.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site