https://gcc.gnu.org/g:389b68a1b98f30e44b86ef298456ef0014471c38

commit r17-3952-g389b68a1b98f30e44b86ef298456ef0014471c38
Author: Matt Turner <[email protected]>
Date:   Sun Sep 6 08:13:22 2026 -0600

    [PATCH 2/2] include: Parenthesize sdiv_qrnnd macro parameters in longlong.h
    
    The i370/s390 and vax sdiv_qrnnd macros expand n1 and n0 without
    parentheses, so an argument containing a comma or an assignment is
    misparsed.  Every other use of these parameters in the file is already
    parenthesized; libgcrypt fixed the same two sites in its copy.
    
    Both blocks are 32-bit only and no in-tree caller passes such an
    expression, so this is a latent bug fixed by inspection.  The i370/s390
    block compiles to identical assembly before and after with
    s390x-linux-gnu-gcc -m31; there is no vax compiler here.
    
    include/ChangeLog:
    
            * longlong.h [__i370__, __s390__, __mvs__] (sdiv_qrnnd): Wrap
            the n1 and n0 macro parameters in parentheses.
            [__vax__] (sdiv_qrnnd): Likewise.

Diff:
---
 include/longlong.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/longlong.h b/include/longlong.h
index 213cbf4948a6..5f44c1c6a011 100644
--- a/include/longlong.h
+++ b/include/longlong.h
@@ -422,7 +422,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
     union {DItype __ll;                                                        
\
           struct {USItype __h, __l;} __i;                              \
          } __x;                                                        \
-    __x.__i.__h = n1; __x.__i.__l = n0;                                        
\
+    __x.__i.__h = (n1); __x.__i.__l = (n0);                            \
     __asm__ ("dr %0,%2"                                                        
\
             : "=r" (__x.__ll)                                          \
             : "0" (__x.__ll), "r" (d));                                \
@@ -1518,7 +1518,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
     union {DItype __ll;                                                        
\
           struct {SItype __l, __h;} __i;                               \
          } __xx;                                                       \
-    __xx.__i.__h = n1; __xx.__i.__l = n0;                              \
+    __xx.__i.__h = (n1); __xx.__i.__l = (n0);                          \
     __asm__ ("ediv %3,%2,%0,%1"                                                
\
             : "=g" (q), "=g" (r)                                       \
             : "g" (__xx.__ll), "g" (d));                               \

Reply via email to