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]

RFC: Hack to make restrict more useful


This bug:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33272

is about a situation in which -fargument-noalias works better than
putting "restrict" on all pointer arguments to a function, even though
that should be logically equivalent.  Using "restrict" for all arguments
to a function is probably one of the most common cases of "restrict";
that's what you want for things like the test case I posted, and for
other Fortran-ish code.

I have a prototype hack which changes checks of flag_argument_noalias !=
0 to also check for the presence of "restrict" on all pointer arguments.
 This fixes the test case, modulo a C front-end bug which Joseph has
volunteered to fix.

To make that a real patch, here's what I plan to do:

(1) Add a flag to "struct function" to say "all pointer arguments are
restrict".

(2) Lazily set it, when something wants to check it.

(3) Change checks of flag_argument_noalias to call a function
argument_noalias() which will return an "int" with the same meaning as
flag_argument_noalias.

Does that plan sound OK to folks?

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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