+2018-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 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.
+
2018-06-20 Richard Biener <rguenther@suse.de>
Backport from mainline
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)))
2018-06-25 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2017-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83059
+ * c-c++-common/pr83059.c: New test.
+
2017-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/82781
--- /dev/null
+/* 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 "\[uU]nknown architecture specifi" "" { target *-*-* } .-1 } */
+ /* { dg-warning "failure memory model cannot be stronger than success memory model" "" { target *-*-* } .-2 } */
+}