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/32810] New: Not folding of const element for goto


Testcase:
void a(int*);  void b(int*);  void c(int*);  void d(int*);
void func2(int* val) {
  const void *const labels[] = { &&a, &&b, &&c, &&d };
  goto *labels[2];
  a: a(val);
  b: b(val);
  c: c(val);
  d: d(val);
}

Right now we get (for PPC-darwin):

;; goto labels[2]
(insn 6 5 7 t5.c:10 (set (reg:SI 121)
        (high:SI (label_ref:SI 0))) -1 (nil))

(insn 7 6 8 t5.c:10 (set (reg:SI 120)
        (lo_sum:SI (reg:SI 121)
            (label_ref:SI 0))) -1 (expr_list:REG_EQUAL (label_ref:SI 0)
        (nil)))

(jump_insn 8 7 9 t5.c:10 (set (pc)
        (reg:SI 120)) -1 (nil))


See how we get the "correct" proping of array element.


-- 
           Summary: Not folding of const element for goto
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          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=32810


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