aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-11-21 09:06:28 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-11-21 09:06:28 +0100
commitd44ed508a66686e0c2fdf48f4cd4a9ad8a1b0547 (patch)
tree389dea12b4c4014e0f61fc4db8838b2ac5e6afd7 /gcc
parent8b87e0d12576318e2ae02284e767b4d083cc4149 (diff)
downloadgcc-d44ed508a66686e0c2fdf48f4cd4a9ad8a1b0547.zip
gcc-d44ed508a66686e0c2fdf48f4cd4a9ad8a1b0547.tar.gz
gcc-d44ed508a66686e0c2fdf48f4cd4a9ad8a1b0547.tar.bz2
re PR c++/83059 (ICE on invalid C++ code: in tree_to_uhwi, at tree.c:6633)
PR c++/83059 * c-common.c (get_atomic_generic_size): Use TREE_INT_CST_LOW instead of tree_to_uhwi, formatting fix. * config/i386/i386.c (ix86_memmodel_check): Start -Winvalid-memory-model diagnostics with lowercase letter. * c-c++-common/pr83059.c: New test. From-SVN: r254990
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c15
-rw-r--r--gcc/config/i386/i386.c2
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/c-c++-common/pr83059.c10
6 files changed, 32 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 207e6f3..a7bbd9c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2017-11-21 Jakub Jelinek <jakub@redhat.com>
+ PR c++/83059
+ * config/i386/i386.c (ix86_memmodel_check): Start
+ -Winvalid-memory-model diagnostics with lowercase letter.
+
PR debug/82718
* dwarf2out.c (dw_loc_list): If crtl->has_bb_partition, temporarily
set in_cold_section_p to the partition containing loc_list->first.
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 1e5c3d3..7258f86 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83059
+ * c-common.c (get_atomic_generic_size): Use TREE_INT_CST_LOW
+ instead of tree_to_uhwi, formatting fix.
+
2017-11-20 David Malcolm <dmalcolm@redhat.com>
PR c/81404
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 65d37c6..969f41b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -6671,13 +6671,14 @@ get_atomic_generic_size (location_t loc, tree function,
tree p = (*params)[x];
if (TREE_CODE (p) == INTEGER_CST)
{
- int i = tree_to_uhwi (p);
- if (i < 0 || (memmodel_base (i) >= MEMMODEL_LAST))
- {
- warning_at (loc, OPT_Winvalid_memory_model,
- "invalid memory model argument %d of %qE", x + 1,
- function);
- }
+ /* memmodel_base masks the low 16 bits, thus ignore any bits above
+ it by using TREE_INT_CST_LOW instead of tree_to_*hwi. Those high
+ bits will be checked later during expansion in target specific
+ way. */
+ if (memmodel_base (TREE_INT_CST_LOW (p)) >= MEMMODEL_LAST)
+ warning_at (loc, OPT_Winvalid_memory_model,
+ "invalid memory model argument %d of %qE", x + 1,
+ function);
}
else
if (!INTEGRAL_TYPE_P (TREE_TYPE (p)))
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1775697..b3228860 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -49066,7 +49066,7 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val)
|| ((val & IX86_HLE_ACQUIRE) && (val & IX86_HLE_RELEASE)))
{
warning (OPT_Winvalid_memory_model,
- "Unknown architecture specific memory model");
+ "unknown architecture specific memory model");
return MEMMODEL_SEQ_CST;
}
strong = (is_mm_acq_rel (model) || is_mm_seq_cst (model));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ca2206c..05638e7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2017-11-21 Jakub Jelinek <jakub@redhat.com>
+ PR c++/83059
+ * c-c++-common/pr83059.c: New test.
+
PR debug/82718
* gcc.dg/debug/dwarf2/pr82718-1.c: New test.
* gcc.dg/debug/dwarf2/pr82718-2.c: New test.
diff --git a/gcc/testsuite/c-c++-common/pr83059.c b/gcc/testsuite/c-c++-common/pr83059.c
new file mode 100644
index 0000000..44ff67c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr83059.c
@@ -0,0 +1,10 @@
+/* PR c++/83059 */
+/* { dg-do compile } */
+
+void
+foo (int *p, int *q, int *r)
+{
+ __atomic_compare_exchange (p, q, r, 0, 0, -1); /* { dg-warning "invalid memory model argument 6" } */
+ /* { dg-warning "unknown architecture specifi" "" { target *-*-* } .-1 } */
+ /* { dg-warning "failure memory model cannot be stronger than success memory model" "" { target *-*-* } .-2 } */
+}