Hi!

The enum memmodel doesn't declare the target specific enumerators,
which are just defines in i386.h, but as those are above any
enumerators in the generic enum, it is strictly speaking UB when
values with that enum memmodel type have the higher target dependent bits
set.  This patch just makes sure that the enumerator is full signed 32-bit.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2018-03-19  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/84643
        * memmodel.h (enum memmodel): Add MEMMODEL_MAX enumerator.

--- gcc/memmodel.h.jj   2018-01-03 10:19:55.495534012 +0100
+++ gcc/memmodel.h      2018-03-19 10:31:42.980812157 +0100
@@ -45,7 +45,9 @@ enum memmodel
   MEMMODEL_LAST = 6,
   MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC,
   MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC,
-  MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC
+  MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC,
+  /* Say that all the higher bits are valid target extensions.  */
+  MEMMODEL_MAX = INTTYPE_MAXIMUM (int)
 };
 
 /* Return the memory model from a host integer.  */

        Jakub

Reply via email to