This is the mail archive of the gcc-patches@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: [PATCH] Fix common_pointer_type for fn pointers where one has __attribute__((const)) and one does not (PR tree-optimization/32139)


On Thu, 31 May 2007, Jakub Jelinek wrote:

> On FUNCTION_TYPE TREE_READONLY means the fn has __attribute__((const))
> and that should be merged IMHO conservatively, TREE_READONLY on the
> common fntype onlyl if both functions are __attribute__((const)),
> otherwise we can optimize out some invocations even when they have
> side-effects.

I think the same should apply to the volatile qualifier (used for 
noreturn) as well; build_c_cast treats them the same for -Wcast-qual 
warnings.

> --- gcc/testsuite/gcc.c-torture/execute/20070531-1.c.jj	2007-05-31 13:47:22.000000000 +0200
> +++ gcc/testsuite/gcc.c-torture/execute/20070531-1.c	2007-05-31 13:43:26.000000000 +0200
> @@ -0,0 +1,11 @@
> +/* PR tree-optimization/32139 */
> +int foo (void);
> +int bar (void) __attribute__ ((const));
> +
> +int
> +test (int x)
> +{
> +  int a = (x == 10000 ? foo : bar) ();
> +  int b = (x == 10000 ? foo : bar) ();
> +  return a + b;
> +}

An execute testcase without a main() function seems odd.

-- 
Joseph S. Myers
joseph@codesourcery.com


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