Bug 57134 - [4.9 Regression] ICE with -mstrict-align and inline assembly on ppc64
Summary: [4.9 Regression] ICE with -mstrict-align and inline assembly on ppc64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Alan Modra
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-01 12:16 UTC by Anton Blanchard
Modified: 2013-09-24 11:33 UTC (History)
1 user (show)

See Also:
Host:
Target: powerpc64
Build:
Known to work: 4.7.2, 4.8.1
Known to fail: 4.9.0
Last reconfirmed: 2013-05-01 00:00:00


Attachments
Testcase that ICE's with -mstrict-align on ppc64 (276 bytes, text/x-csrc)
2013-05-01 12:16 UTC, Anton Blanchard
Details
Compilation failure with -mstrict-align on ppc64 (156 bytes, text/plain)
2013-08-04 12:32 UTC, Anton Blanchard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Blanchard 2013-05-01 12:16:22 UTC
Created attachment 29987 [details]
Testcase that ICE's with -mstrict-align on ppc64

The following testcase passes on a ppc64 4.7.2 build but fails on a 4.9.0 20130501 build:

# gcc -m64 -O2 -S -mstrict-align testcase.c

testcase.c: In function 'rb_remove_pages':
testcase.c:16:2: internal compiler error: in expand_asm_operands, at stmt.c:910
  __asm__ __volatile__("# %0,%1" : "=r"(t) : "m"(v->counter));
  ^
0x10604437 expand_asm_operands
        ../../gcc/gcc/stmt.c:910
0x10604b3b expand_asm_stmt(gimple_statement_d*)
        ../../gcc/gcc/stmt.c:1151
0x1022f357 expand_gimple_stmt_1
        ../../gcc/gcc/cfgexpand.c:2154
0x1022f357 expand_gimple_stmt
        ../../gcc/gcc/cfgexpand.c:2309
0x10230b77 expand_gimple_basic_block
        ../../gcc/gcc/cfgexpand.c:4143
0x10233f7b gimple_expand_cfg
        ../../gcc/gcc/cfgexpand.c:4662
Please submit a full bug report,
Comment 1 Alan Modra 2013-05-01 14:32:49 UTC
I think the bug here is that we lose EXPAND_MEMORY when recursively calling expand_expr() for the inner part of a COMPONENT_REF.
Comment 2 Richard Biener 2013-05-02 08:06:45 UTC
Eventually somebody check 4.8.x.
Comment 3 Anton Blanchard 2013-08-04 12:32:23 UTC
Created attachment 30607 [details]
Compilation failure with -mstrict-align on ppc64

The original testcase isn't failing, but this test fails to compile with -mstrict-align:

/tmp/testcase.c: In function 'testcase':
/tmp/testcase.c:12:2: error: output number 0 not directly addressable
  asm volatile("# %0": "+m" (b->zot));
  ^

and passes without -mstrict-align.
Comment 4 Martin Jambor 2013-09-16 13:20:19 UTC
I suppose this has been fixed by r200086 ?
Comment 5 Alan Modra 2013-09-16 13:49:38 UTC
r200086 fixed Anton's first testcase but then he found another one.  See http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00983.html
Comment 6 Alan Modra 2013-09-24 11:32:31 UTC
Author: amodra
Date: Tue Sep 24 11:32:28 2013
New Revision: 202866

URL: http://gcc.gnu.org/viewcvs?rev=202866&root=gcc&view=rev
Log:
	PR middle-end/57134
	PR middle-end/57586
	* stmt.c (expand_asm_operands): Call expand_expr with
	EXPAND_MEMORY for output operands that disallow regs.  Don't
	use EXPAND_WRITE on inout operands.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/stmt.c
Comment 7 Alan Modra 2013-09-24 11:33:26 UTC
Fixed