From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17680 invoked by alias); 14 Sep 2009 16:38:36 -0000 Received: (qmail 17643 invoked by uid 48); 14 Sep 2009 16:38:21 -0000 Date: Mon, 14 Sep 2009 16:38:00 -0000 Subject: [Bug tree-optimization/41355] New: Type of ADDR_EXPR in CALL_EXPR not rebuilt when function is cloned X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "baldrick at free dot fr" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg01309.txt.bz2 Testcase, compile at -O2. A clone "g.clone.0" is formed which is the same as "g", only the second argument has been dropped. The bug is that in the CALL_EXPR the type of the called function is still the original type. // begin testcase static __attribute__((noinline)) int g(int i, int j) { if (j != 0) return 0; return i; } int f(int i) { return g(i, 0); } // end testcase Breaking on verify_gimple_call, and waiting until after "Assembling functions: g.clone.0 float" is printed, notice how the type of the addr_expr is a pointer to "type ", while the type of g.clone.0 (see arg 0) is "type ", and these two types do not match, though they should. (gdb) call debug_tree(fn) QI size unit size align 8 symtab 0 alias set -1 canonical type 0x7ffff70c2540 arg-types chain chain >>> pointer_to_this > unsigned DI size unit size align 64 symtab 0 alias set -1 canonical type 0x7ffff70c26c0> readonly constant arg 0 QI size unit size align 8 symtab 0 alias set -1 canonical type 0x7ffff70c2540 arg-types chain > pointer_to_this > readonly addressable asm_written used nothrow static decl_5 QI file clone.c line 1 col 38 align 8 attributes initial abstract_origin arguments used SI file clone.c line 1 col 44 size unit size align 32 context abstract_origin (reg/v:SI 0 ax [orig:59 i ] [59]) arg-type incoming-rtl (reg:SI 5 di [ i ])> result used ignored regdecl SI file clone.c line 1 col 38 size unit size align 32 context abstract_origin (reg:SI 58 [ ])> (mem:QI (symbol_ref:DI ("g.clone.0") [flags 0x3] ) [0 S1 A8])> clone.c:5:16> -- Summary: Type of ADDR_EXPR in CALL_EXPR not rebuilt when function is cloned Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: baldrick at free dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41355