This is the mail archive of the gcc-help@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: mprotect reports ENOMEM under -O2


On Apr 10, 2011, at 3:18 PM, Ian Lance Taylor wrote:

> To be clear, if I understand your background correctly, your
> modification of gcc is intended to modify the generated code.  That is,
> you mhave not modified gcc such that gcc itself calls mprotect from a
> signal handler.  You have modified gcc such that it generates code which
> calls mprotect from a signal handler.
> 
> Your problem is that when gcc is compiled with -O2, the code that it
> generates does not work correctly.

Yes.  That is correct.

> If that is correct, then you should look closely at the code you have
> added to gcc, and make sure that you have not introduced undefined
> behaviour into gcc itself.  It may help to use the -Wstrict-aliasing and
> -Wstrict-overflow options.  It would be interesting to learn whether
> your gcc also fails if you compile with -O2 -fno-strict-aliasing and/or
> -O2 -fno-strict-overflow.
> 
> Ian

Thanks!  I'll give those ideas a try.

Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@yale.edu
http://www.amittai.com


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