[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-12-12 Thread cvs-commit at gcc dot gnu dot org

--- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-12 
21:01 ---
Subject: Bug 17564

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]   2004-12-12 21:01:17

Modified files:
gcc: ChangeLog dojump.c 

Log message:
PR middle-end/17564
* dojump.c (do_compare_and_jump): Only canonicalize function pointers
in a comparison if both sides are function pointers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gccr1=2.6793r2=2.6794
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dojump.c.diff?cvsroot=gccr1=1.33r2=1.34



-- 


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-12-12 Thread cvs-commit at gcc dot gnu dot org

--- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-13 
04:08 ---
Subject: Bug 17564

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]   2004-12-13 04:08:40

Modified files:
gcc/testsuite  : ChangeLog 
Added files:
gcc/testsuite/gcc.c-torture/execute: 20041212-1.c 

Log message:
PR middle-end/17564
* gcc.c-torture/execute/20041212-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gccr1=1.4742r2=1.4743
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20041212-1.c.diff?cvsroot=gccr1=NONEr2=1.1



-- 


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-12-12 Thread danglin at gcc dot gnu dot org

--- Additional Comments From danglin at gcc dot gnu dot org  2004-12-12 
21:19 ---
Fixed by patch.


-- 
   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-12-05 Thread dave at hiauly1 dot hia dot nrc dot ca

--- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  
2004-12-05 22:43 ---
Subject: Re:  [4.0 Regression] New treatment of function

Nathanael,

 Do you think we could canonicalize only when
 we compare a function pointer to a function pointer
 (rather than when comparing a function pointer to a void pointer)?  Would
 that
 do the trick, or would it lead to further trouble?
 
 Tentative, untested patch attached.

I seem to have used a version of gcc without your patch when
I checked it with the PR testcase.  Would you please submit it
to gcc-patches as a fix for the PR?  The patch has a parenthesis
typo that needs fixing.

Dave


-- 


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-11-29 Thread dave at hiauly1 dot hia dot nrc dot ca

--- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  
2004-11-30 03:42 ---
Subject: Re:  [4.0 Regression] New treatment of function

 Do you think we could canonicalize only when
 we compare a function pointer to a function pointer
 (rather than when comparing a function pointer to a void pointer)?  Would
 that
 do the trick, or would it lead to further trouble?
 
 Tentative, untested patch attached.

This provides some improvement (i.e., it fixes the testsuite fail
that prompted the PR) but the testcase that I submitted with the PR
still fails.  I need to investigate why the function pointer in the
comparison is still getting canonicalized.

Dave


-- 


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-11-28 Thread dave at hiauly1 dot hia dot nrc dot ca

--- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  
2004-11-28 23:16 ---
Subject: Re:  [4.0 Regression] New treatment of function

 Do you think we could canonicalize only when
 we compare a function pointer to a function pointer
 (rather than when comparing a function pointer to a void pointer)?  Would
 that
 do the trick, or would it lead to further trouble?

That seems correct to me.  Similarly, we wouldn't want canonicalization
when comparing a function pointer with an integer.

 Tentative, untested patch attached.

I'll give it a try.

Dave


-- 


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-11-26 Thread neroden at gcc dot gnu dot org

--- Additional Comments From neroden at gcc dot gnu dot org  2004-11-27 
00:53 ---
I'm going to guess that one solution is to canonicalize any function pointer 
any time it's cast to a void pointer.  (Or do you really, really want 
noncanonicalized pointers, which is likely to be harder?) 
 
This probably requires recognition at tree level that casts from function 
pointer to void pointer may be necessary (among other things). 
 
From tree_ssa_useless_type_conversion_1 in tree_ssa.c: 
  /* If both types are pointers and the outer type is a (void *), then 
 the conversion is not necessary.  The opposite is not true since 
 that conversion would result in a loss of information if the 
 equivalence was used.  Consider an indirect function call where 
 we need to know the exact type of the function to correctly 
 implement the ABI.  */ 
  else if (POINTER_TYPE_P (inner_type) 
POINTER_TYPE_P (outer_type) 
TYPE_MODE (inner_type) == TYPE_MODE (outer_type) 
TYPE_REF_CAN_ALIAS_ALL (inner_type) 
  == TYPE_REF_CAN_ALIAS_ALL (outer_type) 
TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE) 
return true; 
 
So it seems that this type conversion isn't useless when converting from 
a function pointer to a void pointer (on targets where function pointers need 
canonicalization); it requires a canonicalization.  (Or a forcing of 
non-canonicalization, which sounds harder.) 
 
Confirming. 
 

-- 
   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
   Last reconfirmed|-00-00 00:00:00 |2004-11-27 00:53:19
   date||
Summary|[4.0 Regression] New|[4.0 Regression] New
   |treatment of function   |treatment of function
   |pointers when used with |pointers when used with
   |equality operators  |equality operators, when
   ||casts are involved


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved

2004-11-26 Thread dave at hiauly1 dot hia dot nrc dot ca

--- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  
2004-11-27 04:09 ---
Subject: Re:  [4.0 Regression] New treatment of function

 --- Additional Comments From neroden at gcc dot gnu dot org  2004-11-27
 00:53 ---
 I'm going to guess that one solution is to canonicalize any function pointer
 
 any time it's cast to a void pointer.  (Or do you really, really want 
 noncanonicalized pointers, which is likely to be harder?) 

I believe we really want noncanonicalized pointers.  For example, the
following code works in 3.4 (i.e., a function pointer cast to void
pointer and back to a function pointer yields a function pointer that
can be used in a call to a compatible function):

void *f (void) __attribute__ ((__noinline__));
void *
f (void)
{
  return f;
}
int
main (void)
{
  void * (*g) (void) = f ();
  if (g () != f)
abort ();
  exit (0);
}

If the call to f returned a canonicalized value, the call using g
would fail if the target was in a shared library (external).  The
PIC register wouldn't be correctly set.

Dave


-- 


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


[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators

2004-11-10 Thread tausq at debian dot org


-- 
   What|Removed |Added

 CC||tausq at debian dot org


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