Fix ICE with scalar_storage_order attribute at -O

Message ID 1832183.4RgaH2jVQo@polaris
State New
Headers show
Series
  • Fix ICE with scalar_storage_order attribute at -O
Related show

Commit Message

Eric Botcazou Feb. 9, 2018, 9:50 a.m.
This is a regression present on the mainline in the form of an assertion 
failure in optimize_bitfield_assignment_op with a scalar_storage_order 
attribute specifying the reverse endianness wrt the native endianness.

I put this assertion because I failed to cover the path at the time but things 
have changed since then and the attached testcase triggers it now (and also 
checks that the generated code is correct in this case).

Tested on x86_64-suse-linux, applied on the mainline.


2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>

	* expr.c (optimize_bitfield_assignment_op): Remove obsolete assertion.


2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/sso8.adb: New test.
	* gnat.dg/sso8_pkg.ads: New helper.

Patch

Index: expr.c
===================================================================
--- expr.c	(revision 257404)
+++ expr.c	(working copy)
@@ -4726,8 +4726,6 @@  optimize_bitfield_assignment_op (poly_ui
     }
   else if (!REG_P (str_rtx) && GET_CODE (str_rtx) != SUBREG)
     return false;
-  else
-    gcc_assert (!reverse);
 
   /* If the bit field covers the whole REG/MEM, store_field
      will likely generate better code.  */