aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-03-03 17:56:07 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-03-03 17:56:07 +0000
commit3a5c579a89de0fe4afc697ed9bb59c71b42f6016 (patch)
treed1f88567395850412def447508785b14089291c1
parent590e26360c16934958e37d65e019207425e23538 (diff)
downloadgcc-3a5c579a89de0fe4afc697ed9bb59c71b42f6016.zip
gcc-3a5c579a89de0fe4afc697ed9bb59c71b42f6016.tar.gz
gcc-3a5c579a89de0fe4afc697ed9bb59c71b42f6016.tar.bz2
fold-const.c (round_up_loc): Cast divisor to HOST_WIDE_INT before negating it.
* fold-const.c (round_up_loc): Cast divisor to HOST_WIDE_INT before negating it. * tree-sra.c (pa_sra_preliminary_function_checks): Fix typo in message. From-SVN: r221159
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow5.adb20
-rw-r--r--gcc/tree-sra.c2
5 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c1bb27..a562ee7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * fold-const.c (round_up_loc): Cast divisor to HOST_WIDE_INT before
+ negating it.
+
+ * tree-sra.c (pa_sra_preliminary_function_checks): Fix typo in message.
+
2015-03-03 Max Filippov <jcmvbkbc@gmail.com>
Implement call0 ABI for xtensa
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8377120..f9f7f26 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -16032,7 +16032,7 @@ round_up_loc (location_t loc, tree value, unsigned int divisor)
t = build_int_cst (TREE_TYPE (value), divisor - 1);
value = size_binop_loc (loc, PLUS_EXPR, value, t);
- t = build_int_cst (TREE_TYPE (value), -divisor);
+ t = build_int_cst (TREE_TYPE (value), - (HOST_WIDE_INT) divisor);
value = size_binop_loc (loc, BIT_AND_EXPR, value, t);
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d1eaddb..d38eb52 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/object_overflow5.adb: New test.
+
2015-03-03 Martin Liska <mliska@suse.cz>
PR ipa/65287
diff --git a/gcc/testsuite/gnat.dg/object_overflow5.adb b/gcc/testsuite/gnat.dg/object_overflow5.adb
new file mode 100644
index 0000000..4a4f6cf
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/object_overflow5.adb
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+
+procedure Object_Overflow5 is
+
+ procedure Proc (c : Character) is begin null; end;
+
+ type Index is new Long_Integer range 0 .. Long_Integer'Last;
+
+ type Arr is array(Index range <>) of Character;
+
+ type Rec (Size: Index := 6) is record -- { dg-warning "Storage_Error" }
+ A: Arr (0..Size);
+ end record;
+
+ Obj : Rec; -- { dg-warning "Storage_Error" }
+
+begin
+ Obj.A(1) := 'a';
+ Proc (Obj.A(1));
+end;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index a6cddaf..0aed4d2 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -5144,7 +5144,7 @@ ipa_sra_preliminary_function_checks (struct cgraph_node *node)
{
if (dump_file)
fprintf (dump_file,
- "A function call has an argument with non-unit alignemnt.\n");
+ "A function call has an argument with non-unit alignment.\n");
return false;
}