public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/25558]  New: Arguments cannot alias local variables
@ 2005-12-25  4:13 pinskia at gcc dot gnu dot org
  2005-12-25  4:16 ` [Bug tree-optimization/25558] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  4:13 UTC (permalink / raw)
  To: gcc-bugs

I cannot remember if I filed a bug about this or not but I noticed this while
looking at some Fortran code.  Here is testcase which shows the issue:
void link_error(void);

int *t;
int g(int *a)
{
  t = a;
  *a = 2;
}

void f(int *a)
{
  int b;
  b = 1;
  g(&b);
  b = 2;
  *a = 1;  <--- a cannot point to b here.
  if (b == 2)
    link_error();
}

int main(void)
{
  int t;
  f(&t);
  return 0;
}


-- 
           Summary: Arguments cannot alias local variables
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
@ 2005-12-25  4:16 ` pinskia at gcc dot gnu dot org
  2005-12-25  4:19 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  4:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-25 04:16 -------
Woops I had messed up the testcase, anyways the following line:
  if (b == 2)
Should be replaced with:
  if (b != 2)


This is already done on the RTL level.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |TREE


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
  2005-12-25  4:16 ` [Bug tree-optimization/25558] " pinskia at gcc dot gnu dot org
@ 2005-12-25  4:19 ` pinskia at gcc dot gnu dot org
  2005-12-25  4:20 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  4:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-25 04:19 -------
CSE is the one which does this on the rtl level.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |19721
              nThis|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
  2005-12-25  4:16 ` [Bug tree-optimization/25558] " pinskia at gcc dot gnu dot org
  2005-12-25  4:19 ` pinskia at gcc dot gnu dot org
@ 2005-12-25  4:20 ` pinskia at gcc dot gnu dot org
  2005-12-25  4:56 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  4:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-12-25  4:20 ` pinskia at gcc dot gnu dot org
@ 2005-12-25  4:56 ` pinskia at gcc dot gnu dot org
  2005-12-25  5:05 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  4:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-12-25 04:56 -------
What is interesting is that ICC does not even do this optimization.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-12-25  4:56 ` pinskia at gcc dot gnu dot org
@ 2005-12-25  5:05 ` pinskia at gcc dot gnu dot org
  2005-12-25  5:30 ` pinskia at gcc dot gnu dot org
  2006-01-11  1:07 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  5:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-12-25 05:04 -------
(In reply to comment #3)
> What is interesting is that ICC does not even do this optimization.

Even LLVM does this optimization, I am starting to think ICC is not really a
good compiler.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-12-25  5:05 ` pinskia at gcc dot gnu dot org
@ 2005-12-25  5:30 ` pinskia at gcc dot gnu dot org
  2006-01-11  1:07 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-25  5:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2005-12-25 05:30 -------
(In reply to comment #4)
> (In reply to comment #3)
> > What is interesting is that ICC does not even do this optimization.
> 
> Even LLVM does this optimization, I am starting to think ICC is not really a
> good compiler.

Ifort actually does this optimization, it is just weird that.  Here is the
equivalent Fortran code:
module f1
contains
function g(a)
integer g
integer a
g = 1
a = 2
end function
function f(a)
real f
integer a
integer b
integer c
b=1
c = g(b)
b = 1
a = 2
if (b .ne. 1) then
call link_error ()
end if
f = 1
end function
end module


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/25558] Arguments cannot alias local variables
  2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-12-25  5:30 ` pinskia at gcc dot gnu dot org
@ 2006-01-11  1:07 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-11  1:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-01-11 01:07 -------
Oh, this is a dup of bug 23086.

*** This bug has been marked as a duplicate of 23086 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-01-11  1:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-25  4:13 [Bug tree-optimization/25558] New: Arguments cannot alias local variables pinskia at gcc dot gnu dot org
2005-12-25  4:16 ` [Bug tree-optimization/25558] " pinskia at gcc dot gnu dot org
2005-12-25  4:19 ` pinskia at gcc dot gnu dot org
2005-12-25  4:20 ` pinskia at gcc dot gnu dot org
2005-12-25  4:56 ` pinskia at gcc dot gnu dot org
2005-12-25  5:05 ` pinskia at gcc dot gnu dot org
2005-12-25  5:30 ` pinskia at gcc dot gnu dot org
2006-01-11  1:07 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).