Bug 46349 - [4.6 regression] incorrect scalarization
Summary: [4.6 regression] incorrect scalarization
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.6.0
: P1 normal
Target Milestone: 4.6.0
Assignee: Martin Jambor
URL:
Keywords:
Depends on: 46351 46377
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-07 19:43 UTC by Eric Botcazou
Modified: 2010-11-15 16:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
opt9.adb (235 bytes, text/plain)
2010-11-07 19:45 UTC, Eric Botcazou
Details
opt9_pkg.ads (58 bytes, text/plain)
2010-11-07 19:46 UTC, Eric Botcazou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Botcazou 2010-11-07 19:43:51 UTC
The fix for PR tree-opt/44972 has introduced regressions in Ada, specifically:

    (sra_modify_assign): Removed ref_expr_for_all_replacements_p checks,
    checks for return values of build_ref_for_offset.

sra_modify_assign now builds addresses of non-byte-aligned references, leading to the expected ICE later in the RTL expander:

eric@atlantis:~/build/gcc/native32> gcc/xgcc -Bgcc -S opt9.adb -gnatws -O
+===========================GNAT BUG DETECTED==============================+
| 4.6.0 20101105 (experimental) [trunk revision 166350] (i586-suse-linux-gnu) GCC error:|
| in expand_expr_addr_expr_1, at expr.c:7009                               |
| Error detected around opt9.adb:17:7                   

The non-byte-aligned reference is a bitfield with aggregate type.  I think that the checks of the return values should be reinstated somehow or other.

The testcase is suitable for addition to the gnat.dg testsuite.
Comment 1 Eric Botcazou 2010-11-07 19:45:50 UTC
Created attachment 22310 [details]
opt9.adb
Comment 2 Eric Botcazou 2010-11-07 19:46:51 UTC
Created attachment 22311 [details]
opt9_pkg.ads
Comment 3 Martin Jambor 2010-11-09 14:33:25 UTC
Mine.
Comment 4 Martin Jambor 2010-11-10 12:24:05 UTC
Patch posted to the mailing list:

http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01013.html
Comment 5 Martin Jambor 2010-11-15 16:32:23 UTC
Author: jamborm
Date: Mon Nov 15 16:32:18 2010
New Revision: 166759

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166759
Log:
2010-11-15  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/46349
	* tree-sra.c (contains_bitfld_comp_ref_p): New function.
	(contains_vce_or_bfcref_p): Likewise.
	(sra_modify_assign): Use them.

	* testsuite/gnat.dg/opt9.adb: New file.
	* testsuite/gnat.dg/opt9_pkg.ads: Likewise


Added:
    trunk/gcc/testsuite/gnat.dg/opt9.adb
    trunk/gcc/testsuite/gnat.dg/opt9_pkg.ads
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-sra.c
Comment 6 Martin Jambor 2010-11-15 16:36:52 UTC
Fixed.