This is the mail archive of the 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: New GCC takes 19x as long to compile my program (compared to old GCC), plus void** patch suggestion

On Wed, Aug 8, 2012 at 12:09 PM, Elmar Krieger <> wrote:

>> Not at all high.  See Type-Based Alias Analysis
>> <>
>> for one reason.
> Thanks, I read the article, but didn't really see how forbidding a function
> with argument void** to accept a pointer to any pointer helps with aliasing.
> If it's perfectly normal that a function with argument void* accepts any
> pointer, then a function with argument void** should accept a pointer to any
> pointer by analogy, without having additional aliasing problems, no?

The C and C++ languages could work that way, yes.  But they don't.
GCC attempts to implement the standard language.

Aliasing issues arise when a function has two pointers, and determine
whether an assignment to *p1 might change the value at *p2.  There are
no aliasing issues with a void* pointer, because if p1 is void* then
*p1 is invalid.  That is not true for a void** pointer, so aliasing
issues do arise.  If p1 is void** and p2 is int**, then GCC will
assume that an assignment to *p1 does not change the value at *p2, as
the language standard states.  It's easy to imagine that that could
break a program after inlining.


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