From 82711f6567ef069eebb942e382e2c3fa61fbf538 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 1 Aug 2024 14:23:42 +0000 Subject: automatic import of compat-libgfortran-48 --- gcc48-pr82274.patch | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 gcc48-pr82274.patch (limited to 'gcc48-pr82274.patch') diff --git a/gcc48-pr82274.patch b/gcc48-pr82274.patch new file mode 100644 index 0000000..5a330b9 --- /dev/null +++ b/gcc48-pr82274.patch @@ -0,0 +1,40 @@ +2017-10-13 Jakub Jelinek + + PR target/82274 + * libgcc2.c (__mulvDI3): If both operands have + the same highpart of -1 and the topmost bit of lowpart is 0, + multiplication overflows even if both lowparts are 0. + + * gcc.dg/pr82274-1.c: New test. + +--- libgcc/libgcc2.c 2017/10/13 16:50:13 253733 ++++ libgcc/libgcc2.c 2017/10/13 17:19:12 253734 +@@ -375,7 +375,8 @@ + } + else + { +- if (uu.s.high == (Wtype) -1 && vv.s.high == (Wtype) - 1) ++ if ((uu.s.high & vv.s.high) == (Wtype) -1 ++ && (uu.s.low | vv.s.low) != 0) + { + DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low + * (UDWtype) (UWtype) vv.s.low}; +--- /dev/null ++++ gcc/testsuite/gcc.dg/pr82274-1.c +@@ -0,0 +1,16 @@ ++/* PR target/82274 */ ++/* { dg-do run } */ ++/* { dg-shouldfail "trapv" } */ ++/* { dg-options "-ftrapv" } */ ++ ++int ++main () ++{ ++#ifdef __SIZEOF_INT128__ ++ volatile __int128 m = -(((__int128) 1) << (__CHAR_BIT__ * __SIZEOF_INT128__ / 2)); ++#else ++ volatile long long m = -(1LL << (__CHAR_BIT__ * __SIZEOF_LONG_LONG__ / 2)); ++#endif ++ m = m * m; ++ return 0; ++} -- cgit v1.2.3