ANSI alias rules checker in GCC, other optimizing compilers

andreybokhanko@gmail.com
16 Jan 2007 12:45:05 -0500

          From comp.compilers

Related articles
ANSI alias rules checker in GCC, other optimizing compilers andreybokhanko@gmail.com (2007-01-16)
Re: ANSI alias rules checker in GCC, other optimizing compilers ian@airs.com (Ian Lance Taylor) (2007-01-17)
Re: ANSI alias rules checker in GCC, other optimizing compilers andreybokhanko@gmail.com (Andrey Bokhanko) (2007-01-17)
Re: ANSI alias rules checker in GCC, other optimizing compilers andreybokhanko@gmail.com (Andrey Bokhanko) (2007-01-17)
Re: ANSI alias rules checker in GCC, other optimizing compilers ian@airs.com (Ian Lance Taylor) (2007-01-17)
Re: ANSI alias rules checker in GCC, other optimizing compilers silvius.rus@gmail.com (Silvius Rus) (2007-01-17)
Re: ANSI alias rules checker in GCC, other optimizing compilers ajonospam@andrew.cmu.edu (Arthur J. O'Dwyer) (2007-01-18)
[1 later articles]
| List of all articles for this month |

From: andreybokhanko@gmail.com
Newsgroups: comp.compilers
Date: 16 Jan 2007 12:45:05 -0500
Organization: Compilers Central
Keywords: C, GCC, question, comment
Posted-Date: 16 Jan 2007 12:45:05 EST

Dear comp.compilers,


Could you, please, suggest me what GCC does under "-Wstrict-aliasing"
and "-Wstrict-aliasing=2"? What interests me is information from
"compiler developer / power user" point of view -- that is, as much
"under the hood" details as possible.


GCC manual says only this:


"-Wstrict-aliasing
This option is only active when '-fstrict-aliasing' is active. It
warns about code which might break the strict aliasing rules that the
compiler is using for optimization. The warning does not catch all
cases, but does attempt to catch the more common pitfalls. It is
included in '-Wall'.


-Wstrict-aliasing=2
This option is only active when '-fstrict-aliasing' is active. It
warns about code which might break the strict aliasing rules that the
compiler is using for optimization. This warning catches more cases
than '-Wstrict-aliasing', but it will also give a warning for some
ambiguous cases that are safe."




Also, what methods other optimizing compilers use to check conformity
of user code with ANSI aliasing rules? Is there an "industry-wide" set
of options / conventions?


Yours,
Andrey
[I presume you know that the issue is that C doesn't let you have pointers
of different types pointing at the same place, but I don't know the details
of GCC's checks, either. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.