summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-10 11:07:28 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-10 11:07:28 +0000
commit4a5cda1358eb806a30d3750dcfee3e9253b5998d (patch)
tree7662eb21d49d1698fcaf48e012c2443104249515 /gcc
parent475a6b35b36e653a9b82d16e4665caabc145ff18 (diff)
downloadlinaro-gcc-4a5cda1358eb806a30d3750dcfee3e9253b5998d.tar.gz
linaro-gcc-4a5cda1358eb806a30d3750dcfee3e9253b5998d.tar.bz2
linaro-gcc-4a5cda1358eb806a30d3750dcfee3e9253b5998d.zip
* expr.c (expand_expr_real_1) <normal_inner_ref>: Always return 0 for
the extraction of a bit-field of null size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205855 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expr.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 110c0a033e9..73f297442df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expr.c (expand_expr_real_1) <normal_inner_ref>: Always return 0 for
+ the extraction of a bit-field of null size.
+
2013-12-10 Marek Polacek <polacek@redhat.com>
PR sanitizer/59437
diff --git a/gcc/expr.c b/gcc/expr.c
index f173d032c21..19df9dc0146 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10157,6 +10157,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
if (target == 0)
target = assign_temp (type, 1, 1);
+ /* ??? Unlike the similar test a few lines below, this one is
+ very likely obsolete. */
if (bitsize == 0)
return target;
@@ -10177,6 +10179,13 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
return target;
}
+ /* If we have nothing to extract, the result will be 0 for targets
+ with SHIFT_COUNT_TRUNCATED == 0 and garbage otherwise. Always
+ return 0 for the sake of consistency, as reading a zero-sized
+ bitfield is valid in Ada and the value is fully specified. */
+ if (bitsize == 0)
+ return const0_rtx;
+
op0 = validize_mem (op0);
if (MEM_P (op0) && REG_P (XEXP (op0, 0)))