This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/17252] [3.5 Regression] LIM can create wrong code because of aliasing


------- Additional Comments From dnovillo at gcc dot gnu dot org  2004-08-31 22:50 -------

Andrew,

Don't force assign bugs.  If you want me to take a look at it, please CC me and
let me decide whether to take the bug or not.



> Compile the following with -O2 --param lim-expensive=1 and notice that the
load of a is pulled out of 
> the loop but we cannot do that because we are accessing what a points to
inside the loop and since 
> char can alias anything (in C) this is a bug.
> 
> char *a;
> void g()
> {
>   int i;
>   for(i=0;i<10;i++)a[i] = 0;
> }
>
How exactly are we changing what 'a' points-to here?  I see no bug.

Show me the invalid transformation?  LIM does _nothing_ to this code.

$ ./cc1 -O2 -fdump-tree-all-vops a.c --param lim-expensive=1
 g

Analyzing compilation unit
Performing intraprocedural optimizations
Assembling functions:
 g

Execution times (seconds)
 parser                :   0.01 (50%) usr   0.00 ( 0%) sys   0.01 (25%) wall
 dominator optimization:   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (25%) wall
 expand                :   0.01 (50%) usr   0.01 (100%) sys   0.00 ( 0%) wall
 flow analysis         :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (25%) wall
 TOTAL                 :   0.02             0.01             0.04
topo:~>
$ diff a.c.t47.loopinit a.c.t48.lim
4,18d3
< ;; 2 loops found, 2 levels
< ;;
< ;; Loop 0:
< ;;  header -1, latch -2, pre-header -1
< ;;  depth 0, level 2, outer -1
< ;;  nodes: -1 0 1 3 2 -2
< ;;
< ;; Loop 1:
< ;;  header 1, latch 3, pre-header -1
< ;;  depth 1, level 1, outer 0
< ;;  nodes: 1 3
< ;; 0 succs { 1 }
< ;; 1 succs { 2 3 }
< ;; 3 succs { 1 }
< ;; 2 succs { -2 }
topo:~>
$ ./cc1 --version
GNU C version 3.5.0 20040831 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.5.0 20040831 (experimental).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129237


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|dnovillo at gcc dot gnu dot |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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