summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'devel/power-ieee128' of git+ssh://gcc.gnu.org/git/gcc into ↵devel/power-ieee128Thomas Koenig2022-01-151-2/+36
|\ | | | | | | devel/power-ieee128
| * power-ieee128: Fix up byte-swapping for IBM extended real(kind=16)Jakub Jelinek2022-01-111-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is a patch to fix up the ppc64be vs. ppc64le byteswapping of IBM extended real(kind=16) and complex(kind=16). Similarly to the BT_COMPLEX case it halves size and doubles nelems for the bswap_array calls. Of course for r16_ibm and r16_ieee conversions one needs to make sure it is only done when the on file data is in that format and not in IEEE quad. 2022-01-11 Jakub Jelinek <jakub@redhat.com> * io/transfer.c (unformatted_read, unformatted_write): When byteswapping IBM extended real(kind=16), handle it as byteswapping two real(kind=8) values.
* | Allow for multiple defaults in endianness and r16 in GFORTRAN_CONVERT_UNIT.Thomas Koenig2022-01-151-55/+56
|/ | | | | | | | | | | | With this patch, it is possible to specify multiple defaults inthe GFORTRAN_CONVERT_UNIT environment variable so that, for example, R16_IEEE and BIG_ENDIAN can be specified together. libgfortran/ChangeLog: * runtime/environ.c: Allow for multiple default values so that separate default specifications for IBM long double format and endianness are possible.
* Handle R16 conversion for POWER in the environment variables.Thomas Koenig2022-01-101-1/+48
| | | | | | | | | | | | | | | | | | | | This patch handles the environment variables for the REAL(KIND=16) variables like for the little/big-endian routines, so users without who have no access to the source or are unwilling to recompile can use this. Syntax is, for example GFORTRAN_CONVERT_UNIT="r16_ieee:10;little_endian:10" ./a.out libgfortran/ChangeLog: * runtime/environ.c (R16_IEEE): New macro. (R16_IBM): New macro. (next_token): Handle IBM R16 conversion cases. (push_token): Likewise. (mark_single): Likewise. (do_parse): Likewise, initialize endian.
* Implement CONVERT specifier for OPEN.Thomas Koenig2022-01-097-15/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch, based on Jakub's work, implements the CONVERT specifier for the power-ieee128 brach. It allows specifying the conversion as r16_ieee,big_endian and the other way around, based on a table. Setting the conversion via environment variable and via program option does not yet work. gcc/ChangeLog: * flag-types.h (enum gfc_convert): Add flags for conversion. gcc/fortran/ChangeLog: * libgfortran.h (unit_convert): Add flags. libgfortran/ChangeLog: * Makefile.in: Regenerate. * io/file_pos.c (unformatted_backspace): Mask off R16 parts for convert. * io/inquire.c (inquire_via_unit): Add cases for R16 parts. * io/open.c (st_open): Add cases for R16 conversion. * io/transfer.c (unformatted_read): Adjust for R16 conversions. (unformatted_write): Likewise. (us_read): Mask of R16 bits. (data_transfer_init): Likewiese. (write_us_marker): Likewise.
* libgfortran: Make sure glibc < 2.32 built powerpc64le-linux libgfortran ↵Jakub Jelinek2022-01-075-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | doesn't use __*ieee128 APIs I've just tried to build libgfortran on an old glibc system (gcc112.fsffrance.org) and unfortunately we still have work to do: [jakub@gcc2-power8 obj38]$ LD_PRELOAD=/home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 /bin/true [jakub@gcc2-power8 obj38]$ LD_BIND_NOW=1 LD_PRELOAD=/home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 /bin/true /bin/true: symbol lookup error: /home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0: undefined symbol: __atan2ieee128 While we do use some libquadmath APIs: readelf -Wr /home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 | grep QUADMATH 0000000000251268 000005e400000026 R_PPC64_ADDR64 0000000000000000 quadmath_snprintf@QUADMATH_1.0 + 0 0000000000251270 0000030600000026 R_PPC64_ADDR64 0000000000000000 strtoflt128@QUADMATH_1.0 + 0 00000000002502e0 0000011600000015 R_PPC64_JMP_SLOT 0000000000000000 ynq@QUADMATH_1.0 + 0 0000000000250390 0000016000000015 R_PPC64_JMP_SLOT 0000000000000000 sqrtq@QUADMATH_1.0 + 0 0000000000250508 000001fa00000015 R_PPC64_JMP_SLOT 0000000000000000 fmaq@QUADMATH_1.0 + 0 0000000000250530 0000021200000015 R_PPC64_JMP_SLOT 0000000000000000 fabsq@QUADMATH_1.0 + 0 0000000000250760 0000030600000015 R_PPC64_JMP_SLOT 0000000000000000 strtoflt128@QUADMATH_1.0 + 0 0000000000250990 000003df00000015 R_PPC64_JMP_SLOT 0000000000000000 cosq@QUADMATH_1.0 + 0 00000000002509f0 0000040a00000015 R_PPC64_JMP_SLOT 0000000000000000 expq@QUADMATH_1.0 + 0 0000000000250a88 0000045100000015 R_PPC64_JMP_SLOT 0000000000000000 erfcq@QUADMATH_1.0 + 0 0000000000250a98 0000045e00000015 R_PPC64_JMP_SLOT 0000000000000000 jnq@QUADMATH_1.0 + 0 0000000000250ac8 0000047e00000015 R_PPC64_JMP_SLOT 0000000000000000 sinq@QUADMATH_1.0 + 0 0000000000250e38 000005db00000015 R_PPC64_JMP_SLOT 0000000000000000 fmodq@QUADMATH_1.0 + 0 0000000000250e48 000005e000000015 R_PPC64_JMP_SLOT 0000000000000000 tanq@QUADMATH_1.0 + 0 0000000000250e58 000005e400000015 R_PPC64_JMP_SLOT 0000000000000000 quadmath_snprintf@QUADMATH_1.0 + 0 0000000000250f20 0000062900000015 R_PPC64_JMP_SLOT 0000000000000000 copysignq@QUADMATH_1.0 + 0 we don't do it consistently: readelf -Wr /home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 | grep ieee128 0000000000250310 0000012800000015 R_PPC64_JMP_SLOT 0000000000000000 __atan2ieee128 + 0 0000000000250340 0000014200000015 R_PPC64_JMP_SLOT 0000000000000000 __clogieee128 + 0 0000000000250438 000001a300000015 R_PPC64_JMP_SLOT 0000000000000000 __acoshieee128 + 0 00000000002504b8 000001cc00000015 R_PPC64_JMP_SLOT 0000000000000000 __csinieee128 + 0 0000000000250500 000001f300000015 R_PPC64_JMP_SLOT 0000000000000000 __sinhieee128 + 0 0000000000250570 0000022a00000015 R_PPC64_JMP_SLOT 0000000000000000 __asinieee128 + 0 0000000000250580 0000022d00000015 R_PPC64_JMP_SLOT 0000000000000000 __roundieee128 + 0 00000000002505a0 0000023e00000015 R_PPC64_JMP_SLOT 0000000000000000 __logieee128 + 0 00000000002505c8 0000024900000015 R_PPC64_JMP_SLOT 0000000000000000 __tanieee128 + 0 0000000000250630 0000027500000015 R_PPC64_JMP_SLOT 0000000000000000 __ccosieee128 + 0 0000000000250670 0000028a00000015 R_PPC64_JMP_SLOT 0000000000000000 __log10ieee128 + 0 00000000002506c8 000002bd00000015 R_PPC64_JMP_SLOT 0000000000000000 __cexpieee128 + 0 00000000002506d8 000002c800000015 R_PPC64_JMP_SLOT 0000000000000000 __coshieee128 + 0 00000000002509b0 000003ef00000015 R_PPC64_JMP_SLOT 0000000000000000 __truncieee128 + 0 0000000000250af8 000004a600000015 R_PPC64_JMP_SLOT 0000000000000000 __expieee128 + 0 0000000000250b50 000004c600000015 R_PPC64_JMP_SLOT 0000000000000000 __fmodieee128 + 0 0000000000250bb0 000004e700000015 R_PPC64_JMP_SLOT 0000000000000000 __tanhieee128 + 0 0000000000250c38 0000051300000015 R_PPC64_JMP_SLOT 0000000000000000 __acosieee128 + 0 0000000000250ce0 0000055400000015 R_PPC64_JMP_SLOT 0000000000000000 __sinieee128 + 0 0000000000250d60 0000057e00000015 R_PPC64_JMP_SLOT 0000000000000000 __atanieee128 + 0 0000000000250dd8 000005b100000015 R_PPC64_JMP_SLOT 0000000000000000 __sqrtieee128 + 0 0000000000250e98 0000060200000015 R_PPC64_JMP_SLOT 0000000000000000 __cosieee128 + 0 0000000000250eb0 0000060a00000015 R_PPC64_JMP_SLOT 0000000000000000 __atanhieee128 + 0 0000000000250ef0 0000062000000015 R_PPC64_JMP_SLOT 0000000000000000 __asinhieee128 + 0 0000000000250fd8 0000067f00000015 R_PPC64_JMP_SLOT 0000000000000000 __csqrtieee128 + 0 0000000000251038 000006ad00000015 R_PPC64_JMP_SLOT 0000000000000000 __cabsieee128 + 0 All these should for POWER_IEEE128 use atan2q@QUADMATH_1.0 etc. It seems all these come from f951 compiled sources. For user code, I think the agreement was if you want to use successfully -mabi=ieeelongdouble, you need glibc 2.32 or later, which is why the Fortran FE doesn't conditionalize on whether glibc 2.32 is available or not and just emits __WHATEVERieee128 entrypoints. But for Fortran compiled sources in libgfortran, we need to use __WHATEVERieee128 only if glibc 2.32 or later and WHATEVERq (from libquadmath) otherwise. The following patch implements that, adds -fbuilding-libgfortran option similar to e.g. -fbuilding-libgcc used when building libgcc and if that option is set and the TARGET_GLIBC_{MAJOR,MINOR} macros indicate no glibc or glibc older than 2.32, it will use the libquadmath APIs rather than glibc 2.32 APIs. 2022-01-07 Jakub Jelinek <jakub@redhat.com> gcc/fortran/ * trans-types.c (gfc_init_kinds): When setting abi_kind to 17, if not targetting glibc 2.32 or later and -fbuilding-libgfortran, set gfc_real16_is_float128 and c_float128 in gfc_real_kinds. (gfc_build_real_type): Don't set c_long_double if c_float128 is already set. * trans-intrinsic.c (builtin_decl_for_precision): Don't use long_double_built_in if gfc_real16_is_float128 and long_double_type_node == gfc_float128_type_node. * lang.opt (fbuilding-libgfortran): New undocumented option. libgfortran/ * Makefile.am (AM_FCFLAGS): Add -fbuilding-libgfortran after -fallow-leading-underscore. * Makefile.in: Regenerated.
* libgfortran: Avoid using libquadmath APIs on powerpc64le on glibc 2.32+Jakub Jelinek2022-01-073-0/+18
| | | | | | | | | | | | | | | | | | | | | | | On a glibc 2.32+ build, we still use some libquadmath APIs when we shouldn't: readelf -Wr /home/jakub/gcc/obj/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5 | grep QUADMATH 00000000002502c8 0000002600000015 R_PPC64_JMP_SLOT 0000000000000000 fmaq@QUADMATH_1.0 + 0 00000000002505f8 0000006700000015 R_PPC64_JMP_SLOT 0000000000000000 tanq@QUADMATH_1.0 + 0 0000000000250930 0000009b00000015 R_PPC64_JMP_SLOT 0000000000000000 fabsq@QUADMATH_1.0 + 0 0000000000250940 0000009d00000015 R_PPC64_JMP_SLOT 0000000000000000 sinq@QUADMATH_1.0 + 0 0000000000250c98 000000cf00000015 R_PPC64_JMP_SLOT 0000000000000000 copysignq@QUADMATH_1.0 + 0 0000000000251038 0000010700000015 R_PPC64_JMP_SLOT 0000000000000000 cosq@QUADMATH_1.0 + 0 0000000000251068 0000010a00000015 R_PPC64_JMP_SLOT 0000000000000000 fmodq@QUADMATH_1.0 + 0 These should use __fmaieee128, __tanieee128 etc. instead. 2022-01-07 Jakub Jelinek <jakub@redhat.com> * libgfortran.h (__copysignieee128, __fmaieee128, __fmodieee128): Declare. * intrinsics/trigd.c (COPYSIGN, FMOD, FABS, FMA, SIN, COS, TAN): If POWER_IEEE128 is defined, define these for kind 17 include. * intrinsics/trigd_lib.inc (COPYSIGN, FMOD, FABS, FMA, SIN, COS, TAN): Don't define if COPYSIGN is already defined.
* Allow other languages to change long double format.Michael Meissner2022-01-051-5/+3
| | | | | | | | | | | | | With Fortran adding support for changing the long double format, this patch removes the code that only allowed C/C++ to change the long double format for GLIBC 2.32 and later without a warning. gcc/ 2022-01-05 Michael Meissner <meissner@the-meissners.org> * config/rs6000/rs6000.c (rs6000_option_override_internal): Remove checks for only C/C++ front ends before allowing the long double format to change without a warning.
* testsuite: Fix pr47614.f testJakub Jelinek2022-01-041-0/+1
| | | | | | | | | | | | | | This test FAILs because f951: Error: '-mabi=ieeelongdouble' requires full ISA 2.06 support compiler exited with status 1 FAIL: gfortran.dg/pr47614.f -O0 (test for excess errors) As powerpc64le* only supports -mcpu=power8 and newer, I think we shouldn't be testing with that option. 2022-01-04 Jakub Jelinek <jakub@redhat.com> * gfortran.dg/pr47614.f: Don't use -mcpu=power4 for powerpc64le*-*-linux*.
* fortran, libgfortran: Add remaining missing *_r17 symbolsJakub Jelinek2022-01-045-41/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following patch adds remaining missing *_r17 entrypoints, so that we have 91 *_r16 and 91 *_r17 entrypoints (and 24 *_c16 and 24 *_c17). This fixes: FAIL: gfortran.dg/dec_math.f90 -O0 execution test FAIL: gfortran.dg/dec_math.f90 -O1 execution test FAIL: gfortran.dg/dec_math.f90 -O2 execution test FAIL: gfortran.dg/dec_math.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/dec_math.f90 -O3 -g execution test FAIL: gfortran.dg/dec_math.f90 -Os execution test FAIL: gfortran.dg/ieee/dec_math_1.f90 -O0 execution test FAIL: gfortran.dg/ieee/dec_math_1.f90 -O1 execution test FAIL: gfortran.dg/ieee/dec_math_1.f90 -O2 execution test FAIL: gfortran.dg/ieee/dec_math_1.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/ieee/dec_math_1.f90 -O3 -g execution test FAIL: gfortran.dg/ieee/dec_math_1.f90 -Os execution test 2022-01-04 Jakub Jelinek <jakub@redhat.com> gcc/fortran/ * trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Use gfc_type_abi_kind. libgfortran/ * libgfortran.h (GFC_REAL_17_INFINITY, GFC_REAL_17_QUIET_NAN): Define. (__erfcieee128): Declare. * intrinsics/trigd.c (_gfortran_sind_r17, _gfortran_cosd_r17, _gfortran_tand_r17): Define for HAVE_GFC_REAL_17. * intrinsics/random.c (random_r17, arandom_r17, rnumber_17): Define. * intrinsics/erfc_scaled.c (ERFC_SCALED): Define. (erfc_scaled_r16): Use ERFC_SCALED macro. (erfc_scaled_r17): Define.
* fortran, libgfortran: Assorted -mabi=ieeelongdouble I/O fixesJakub Jelinek2022-01-042-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another patch, this fixes: FAIL: gfortran.dg/intrinsic_spread_2.f90 -O0 execution test FAIL: gfortran.dg/intrinsic_spread_2.f90 -O1 execution test FAIL: gfortran.dg/intrinsic_spread_2.f90 -O2 execution test FAIL: gfortran.dg/intrinsic_spread_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/intrinsic_spread_2.f90 -O3 -g execution test FAIL: gfortran.dg/intrinsic_spread_2.f90 -Os execution test FAIL: gfortran.dg/intrinsic_unpack_2.f90 -O0 execution test FAIL: gfortran.dg/intrinsic_unpack_2.f90 -O1 execution test FAIL: gfortran.dg/intrinsic_unpack_2.f90 -O2 execution test FAIL: gfortran.dg/intrinsic_unpack_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/intrinsic_unpack_2.f90 -O3 -g execution test FAIL: gfortran.dg/intrinsic_unpack_2.f90 -Os execution test FAIL: gfortran.dg/large_real_kind_form_io_1.f90 -O0 execution test FAIL: gfortran.dg/large_real_kind_form_io_1.f90 -O1 execution test FAIL: gfortran.dg/large_real_kind_form_io_1.f90 -O2 execution test FAIL: gfortran.dg/large_real_kind_form_io_1.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/large_real_kind_form_io_1.f90 -O3 -g execution test FAIL: gfortran.dg/large_real_kind_form_io_1.f90 -Os execution test FAIL: gfortran.dg/quad_2.f90 -O0 execution test FAIL: gfortran.dg/quad_2.f90 -O1 execution test FAIL: gfortran.dg/quad_2.f90 -O2 execution test FAIL: gfortran.dg/quad_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/quad_2.f90 -O3 -g execution test FAIL: gfortran.dg/quad_2.f90 -Os execution test 2022-01-04 Jakub Jelinek <jakub@redhat.com> gcc/fortran/ * trans-io.c (transfer_array_desc): Pass abi kind instead of kind to libgfortran. libgfortran/ * io/read.c (convert_real): Add missing break; for the HAVE_GFC_REAL_17 case.
* libgfortran: -mabi=ieeelongdouble I/O fixJakub Jelinek2022-01-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following patch fixes: FAIL: gfortran.dg/fmt_en.f90 -O0 output pattern test FAIL: gfortran.dg/fmt_en.f90 -O1 output pattern test FAIL: gfortran.dg/fmt_en.f90 -O2 output pattern test FAIL: gfortran.dg/fmt_en.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gfortran.dg/fmt_en.f90 -O3 -g output pattern test FAIL: gfortran.dg/fmt_en.f90 -Os output pattern test FAIL: gfortran.dg/fmt_en_rd.f90 -O0 output pattern test FAIL: gfortran.dg/fmt_en_rd.f90 -O1 output pattern test FAIL: gfortran.dg/fmt_en_rd.f90 -O2 output pattern test FAIL: gfortran.dg/fmt_en_rd.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gfortran.dg/fmt_en_rd.f90 -O3 -g output pattern test FAIL: gfortran.dg/fmt_en_rd.f90 -Os output pattern test FAIL: gfortran.dg/fmt_en_rn.f90 -O0 output pattern test FAIL: gfortran.dg/fmt_en_rn.f90 -O1 output pattern test FAIL: gfortran.dg/fmt_en_rn.f90 -O2 output pattern test FAIL: gfortran.dg/fmt_en_rn.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gfortran.dg/fmt_en_rn.f90 -O3 -g output pattern test FAIL: gfortran.dg/fmt_en_rn.f90 -Os output pattern test FAIL: gfortran.dg/fmt_en_ru.f90 -O0 output pattern test FAIL: gfortran.dg/fmt_en_ru.f90 -O1 output pattern test FAIL: gfortran.dg/fmt_en_ru.f90 -O2 output pattern test FAIL: gfortran.dg/fmt_en_ru.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gfortran.dg/fmt_en_ru.f90 -O3 -g output pattern test FAIL: gfortran.dg/fmt_en_ru.f90 -Os output pattern test FAIL: gfortran.dg/fmt_en_rz.f90 -O0 output pattern test FAIL: gfortran.dg/fmt_en_rz.f90 -O1 output pattern test FAIL: gfortran.dg/fmt_en_rz.f90 -O2 output pattern test FAIL: gfortran.dg/fmt_en_rz.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gfortran.dg/fmt_en_rz.f90 -O3 -g output pattern test FAIL: gfortran.dg/fmt_en_rz.f90 -Os output pattern test FAIL: gfortran.dg/fmt_g0_7.f08 -O0 execution test FAIL: gfortran.dg/fmt_g0_7.f08 -O1 execution test FAIL: gfortran.dg/fmt_g0_7.f08 -O2 execution test FAIL: gfortran.dg/fmt_g0_7.f08 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/fmt_g0_7.f08 -O3 -g execution test FAIL: gfortran.dg/fmt_g0_7.f08 -Os execution test FAIL: gfortran.dg/fmt_pf.f90 -O0 output pattern test FAIL: gfortran.dg/fmt_pf.f90 -O1 output pattern test FAIL: gfortran.dg/fmt_pf.f90 -O2 output pattern test FAIL: gfortran.dg/fmt_pf.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gfortran.dg/fmt_pf.f90 -O3 -g output pattern test FAIL: gfortran.dg/fmt_pf.f90 -Os output pattern test FAIL: gfortran.dg/large_real_kind_1.f90 -O0 execution test FAIL: gfortran.dg/large_real_kind_1.f90 -O1 execution test FAIL: gfortran.dg/large_real_kind_1.f90 -O2 execution test FAIL: gfortran.dg/large_real_kind_1.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: gfortran.dg/large_real_kind_1.f90 -O3 -g execution test FAIL: gfortran.dg/large_real_kind_1.f90 -Os execution test 2022-01-04 Jakub Jelinek <jakub@redhat.com> * io/write_float.def (CALCULATE_EXP): If HAVE_GFC_REAL_17, also use CALCULATE_EXP(17). (determine_en_precision): Use 17 instead of 16 as first EN_PREC argument for kind 17. (get_float_string): Use 17 instead of 16 as first FORMAT_FLOAT argument for kind 17.
* fortran, libgfortran: -mabi=ieeelongdouble I/OJakub Jelinek2022-01-0411-61/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following patch adds the compiler and library side of -mabi=ieeelongdouble I/O support. 2022-01-04 Jakub Jelinek <jakub@redhat.com> gcc/fortran/ * trans-io.c (transfer_namelist_element): Use gfc_type_abi_kind, formatting fixes. (transfer_expr): Use gfc_type_abi_kind, use *REAL128* APIs even for abi_kind == 17. libgfortran/ * libgfortran.h (__acoshieee128, __acosieee128, __asinhieee128, __asinieee128, __atan2ieee128, __atanhieee128, __atanieee128, __coshieee128, __cosieee128, __erfieee128, __expieee128, __fabsieee128, __jnieee128, __log10ieee128, __logieee128, __powieee128, __sinhieee128, __sinieee128, __sqrtieee128, __tanhieee128, __tanieee128, __ynieee128): Formatting fixes. (__strtoieee128, __snprintfieee128): Declare. * io/io.h (default_width_for_float, default_precision_for_float): Handle kind == 17. * io/size_from_kind.c (size_from_real_kind, size_from_complex_kind): Likewise. * io/read.c (set_integer, si_max, convert_real, convert_infnan, read_f): Likewise. * io/write.c (extract_uint, size_from_kind, set_fnode_default): Likewise. * io/write_float.def (DTOA2Q, FDTOA2Q): Define for HAVE_GFC_REAL_17. (determine_en_precision, get_float_string): Handle kind == 17. * io/transfer128.c: Use also for HAVE_GFC_REAL_17, but don't drag in libquadmath if POWER_IEEE128. * Makefile.am (comma, PREPROCESS): New variables. (gfortran.ver): New goal. (version_arg, version_dep): Use gfortran.ver instead of $(srcdir)/gfortran.map. (gfortran.map-sun): Depend on and use gfortran.ver instead of $(srcdir)/gfortran.map. (BUILT_SOURCES): Add $(version_dep). * Makefile.in: Regenerated. * gfortran.map (GFORTRAN_8): Don't export _gfortran_transfer_complex128, _gfortran_transfer_complex128_write, _gfortran_transfer_real128 and _gfortran_transfer_real128_write if HAVE_GFC_REAL_17 is defined. (GFORTRAN_12): Export those here instead.
* libquadmath: Use -mno-gnu-attribute in libquadmathJakub Jelinek2022-01-032-0/+37
| | | | | | | | | | | Testing found that we also need libquadmath to be built with -mno-gnu-attribute, otherwise -mabi=ieeelongdouble programs don't link. 2022-01-03 Jakub Jelinek <jakub@redhat.com> * configure.ac: Set XCFLAGS to -mno-gnu-attribute on powerpc64le*-linux*. * configure: Regenerated.
* Merge branch 'devel/power-ieee128' of git+ssh://gcc.gnu.org/git/gcc into ↵Thomas Koenig2022-01-037-76/+438
|\ | | | | | | devel/power-ieee128
| * gfortran: Introduce gfc_type_abi_kindJakub Jelinek2021-12-315-76/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following patch detects the powerpc64le-linux kind == 16 cases and for the -mabi=ieeelongdouble case (no matter whether it is the configured in default or just option used on the command line) uses _r17 or _c17 instead of _r16 or _c17 in the library API names. From what I can see, e.g. calls to sin on real(kind = 16) works fine with or without this patch (we call __builtin_sinl and the backend uses rs6000_mangle_decl_assembler_name which ensures __sinieee128 is called). What is clearly still broken is IO, where for real(kind=16) a a = 1.0 print *, a end we call _gfortran_transfer_real_write (&dt_parm.0, &a, 16); for both -mabi=ibmlongdouble and -mabi=ieeelongdouble I don't remember what was the agreement, do we want _gfortran_transfer_real_write (&dt_parm.0, &a, 17); for the ieeelongdouble case, or some new entrypoint for the abi_kind == 17 real/complex IO? Also, what about kind stored in array descriptors? Shall we use there the abi_kind or kind? I guess at least before the IO case is solved there is no point in checking the testsuite, too many things will be majorly broken... 2021-12-31 Jakub Jelinek <jakub@redhat.com> * gfortran.h (gfc_real_info): Add abi_kind member. (gfc_type_abi_kind): Declare. * trans-types.c (gfc_init_kinds): Initialize abi_kind. * intrinsic.c (gfc_type_abi_kind): New function. (conv_name): Use it. * iresolve.c (resolve_transformational, gfc_resolve_abs, gfc_resolve_char_achar, gfc_resolve_acos, gfc_resolve_acosh, gfc_resolve_aimag, gfc_resolve_and, gfc_resolve_aint, gfc_resolve_all, gfc_resolve_anint, gfc_resolve_any, gfc_resolve_asin, gfc_resolve_asinh, gfc_resolve_atan, gfc_resolve_atanh, gfc_resolve_atan2, gfc_resolve_bessel_n2, gfc_resolve_ceiling, gfc_resolve_cmplx, gfc_resolve_complex, gfc_resolve_cos, gfc_resolve_cosh, gfc_resolve_count, gfc_resolve_dble, gfc_resolve_dim, gfc_resolve_dot_product, gfc_resolve_dprod, gfc_resolve_exp, gfc_resolve_floor, gfc_resolve_hypot, gfc_resolve_int, gfc_resolve_int2, gfc_resolve_int8, gfc_resolve_long, gfc_resolve_log, gfc_resolve_log10, gfc_resolve_logical, gfc_resolve_matmul, gfc_resolve_minmax, gfc_resolve_maxloc, gfc_resolve_findloc, gfc_resolve_maxval, gfc_resolve_merge, gfc_resolve_minloc, gfc_resolve_minval, gfc_resolve_mod, gfc_resolve_modulo, gfc_resolve_nearest, gfc_resolve_or, gfc_resolve_real, gfc_resolve_realpart, gfc_resolve_reshape, gfc_resolve_sign, gfc_resolve_sin, gfc_resolve_sinh, gfc_resolve_sqrt, gfc_resolve_tan, gfc_resolve_tanh, gfc_resolve_transpose, gfc_resolve_trigd, gfc_resolve_xor, gfc_resolve_random_number): Likewise. * trans-decl.c (gfc_build_intrinsic_function_decls): Likewise.
| * libgfortran: Small progress on the library sideJakub Jelinek2021-12-312-0/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following patch quiets ../../../libgfortran/generated/in_pack_r17.c:35:1: warning: no previous prototype for ‘internal_pack_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/in_pack_c17.c:35:1: warning: no previous prototype for ‘internal_pack_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/in_unpack_r17.c:33:1: warning: no previous prototype for ‘internal_unpack_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/in_unpack_c17.c:33:1: warning: no previous prototype for ‘internal_unpack_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/pack_r17.c:73:1: warning: no previous prototype for ‘pack_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/pack_c17.c:73:1: warning: no previous prototype for ‘pack_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/unpack_r17.c:34:1: warning: no previous prototype for ‘unpack0_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/unpack_r17.c:178:1: warning: no previous prototype for ‘unpack1_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/unpack_c17.c:34:1: warning: no previous prototype for ‘unpack0_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/unpack_c17.c:178:1: warning: no previous prototype for ‘unpack1_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/spread_r17.c:34:1: warning: no previous prototype for ‘spread_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/spread_r17.c:230:1: warning: no previous prototype for ‘spread_scalar_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/spread_c17.c:34:1: warning: no previous prototype for ‘spread_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/spread_c17.c:230:1: warning: no previous prototype for ‘spread_scalar_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift0_r17.c:33:1: warning: no previous prototype for ‘cshift0_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift0_c17.c:33:1: warning: no previous prototype for ‘cshift0_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift1_4_r17.c:32:1: warning: no previous prototype for ‘cshift1_4_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift1_4_c17.c:32:1: warning: no previous prototype for ‘cshift1_4_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift1_8_r17.c:32:1: warning: no previous prototype for ‘cshift1_8_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift1_8_c17.c:32:1: warning: no previous prototype for ‘cshift1_8_c17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift1_16_r17.c:32:1: warning: no previous prototype for ‘cshift1_16_r17’ [-Wmissing-prototypes] ../../../libgfortran/generated/cshift1_16_c17.c:32:1: warning: no previous prototype for ‘cshift1_16_c17’ [-Wmissing-prototypes] warnings during libgfortran build and exports the new entrypoints. Note, not all of them, clearly e.g. there are fewer *_r17* entrypoints than *_r16* entrypoints, so more work is needed. 2021-12-31 Jakub Jelinek <jakub@redhat.com> * libgfortran.h (internal_pack_r17, internal_pack_c17, internal_unpack_r17, internal_unpack_c17, pack_r17, pack_c17, unpack0_r17, unpack0_c17, unpack1_r17, unpack1_c17, spread_r17, spread_c17, spread_scalar_r17, spread_scalar_c17, cshift0_r17, cshift0_c17, cshift1_4_r17, cshift1_8_r17, cshift1_16_r17, cshift1_4_c17, cshift1_8_c17, cshift1_16_c17): Declare. * gfortran.map (GFORTRAN_12): Export *_r17 and *_c17.
* | Make sure the Fortran specifics have real(kind=16).Thomas Koenig2022-01-0340-167/+186
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings the library to compile with all specific functions. It also corrects the patsubst patterns so the right files get the flags. It was necessary to manually add -D__powerpc64__ because apparently this is not set for Fortran. libgfortran/ChangeLog: * Makefile.am: Correct files for compilation flags. Add -D__powerpc64__ for Fortran sources. Get kinds.inc from grep of kinds.h and kinds-override.h. * Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Add -mno-gnu-attribute to compile flags. * generated/_abs_c17.F90: Regenerate. * generated/_abs_r17.F90: Regenerate. * generated/_acos_r17.F90: Regenerate. * generated/_acosh_r17.F90: Regenerate. * generated/_aimag_c17.F90: Regenerate. * generated/_aint_r17.F90: Regenerate. * generated/_anint_r17.F90: Regenerate. * generated/_asin_r17.F90: Regenerate. * generated/_asinh_r17.F90: Regenerate. * generated/_atan2_r17.F90: Regenerate. * generated/_atan_r17.F90: Regenerate. * generated/_atanh_r17.F90: Regenerate. * generated/_conjg_c17.F90: Regenerate. * generated/_cos_c17.F90: Regenerate. * generated/_cos_r17.F90: Regenerate. * generated/_cosh_r17.F90: Regenerate. * generated/_dim_r17.F90: Regenerate. * generated/_exp_c17.F90: Regenerate. * generated/_exp_r17.F90: Regenerate. * generated/_log10_r17.F90: Regenerate. * generated/_log_c17.F90: Regenerate. * generated/_log_r17.F90: Regenerate. * generated/_mod_r17.F90: Regenerate. * generated/_sign_r17.F90: Regenerate. * generated/_sin_c17.F90: Regenerate. * generated/_sin_r17.F90: Regenerate. * generated/_sinh_r17.F90: Regenerate. * generated/_sqrt_c17.F90: Regenerate. * generated/_sqrt_r17.F90: Regenerate. * generated/_tan_r17.F90: Regenerate. * generated/_tanh_r17.F90: Regenerate. * kinds-override.h: Adjust to trunk. Change condition to single line so it can be grepped. * m4/specific.m4: Make sure that real=kind16 is used for _r17.F90 and _c17.F90 files. * m4/specific2.m4: Likewise. * mk-kinds-h.sh: Adjust to trunk.
* Generate config.h macros for IEEE128 math functions.Thomas Koenig2021-12-125-2/+1048
| | | | | | | | | | libgfortran/ChangeLog: * acinclude.m4 (LIBGFOR_CHECK_MATH_IEEE128): New macro. * configure.ac: Use it. * config.h.in: Regenerate. * configure: Regenerate. * Makefile.in: Regenerate.
* Fix pattern substition for _r17 and _c17.Thomas Koenig2021-12-113-10/+36
| | | | | | | | libgfortran/ChangeLog: * Makefile.am: Fix pattern substitution for _r17 and _c17. * Makefile.in: Regenerate. * configure: Regenerate.
* Prepare library for REAL(KIND=17).Thomas Koenig2021-12-06110-254/+27561
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prepares the library side for REAL(KIND=17). It is not yet tested, but at least compiles cleanly on POWER 9 and x86_64. 2021-10-19 Thomas Koenig <tkoenig@gcc.gnu.org> fixincludes/ChangeLog: * configure: Regenerate. * fixincl.x: Regenerate. intl/ChangeLog: * aclocal.m4: Regenerate. * configure: Regenerate. libatomic/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: libcc1/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. libdecnumber/ChangeLog: * configure: Regenerate. libgcc/ChangeLog: * configure: Regenerate. libgfortran/ChangeLog: * Makefile.am: Add _r17 and _c17 files. Build them with -mabi=ieeelongdouble on POWER. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: New flag HAVE_REAL_17. * kinds-override.h: (HAVE_GFC_REAL_17): New macro. (HAVE_GFC_COMPLEX_17): New macro. (GFC_REAL_17_HUGE): New macro. (GFC_REAL_17_LITERAL_SUFFIX): New macro. (GFC_REAL_17_LITERAL): New macro. (GFC_REAL_17_DIGITS): New macro. (GFC_REAL_17_RADIX): New macro. * libgfortran.h (POWER_IEEE128): New macro. (gfc_array_r17): Typedef. (GFC_DTYPE_REAL_17): New macro. (GFC_DTYPE_COMPLEX_17): New macro. (__acoshieee128): Prototype. (__acosieee128): Prototype. (__asinhieee128): Prototype. (__asinieee128): Prototype. (__atan2ieee128): Prototype. (__atanhieee128): Prototype. (__atanieee128): Prototype. (__coshieee128): Prototype. (__cosieee128): Prototype. (__erfieee128): Prototype. (__expieee128): Prototype. (__fabsieee128): Prototype. (__jnieee128): Prototype. (__log10ieee128): Prototype. (__logieee128): Prototype. (__powieee128): Prototype. (__sinhieee128): Prototype. (__sinieee128): Prototype. (__sqrtieee128): Prototype. (__tanhieee128): Prototype. (__tanieee128): Prototype. (__ynieee128): Prototype. * m4/mtype.m4: Make a bit more readable. Add KIND=17. * generated/_abs_c17.F90: New file. * generated/_abs_r17.F90: New file. * generated/_acos_r17.F90: New file. * generated/_acosh_r17.F90: New file. * generated/_aimag_c17.F90: New file. * generated/_aint_r17.F90: New file. * generated/_anint_r17.F90: New file. * generated/_asin_r17.F90: New file. * generated/_asinh_r17.F90: New file. * generated/_atan2_r17.F90: New file. * generated/_atan_r17.F90: New file. * generated/_atanh_r17.F90: New file. * generated/_conjg_c17.F90: New file. * generated/_cos_c17.F90: New file. * generated/_cos_r17.F90: New file. * generated/_cosh_r17.F90: New file. * generated/_dim_r17.F90: New file. * generated/_exp_c17.F90: New file. * generated/_exp_r17.F90: New file. * generated/_log10_r17.F90: New file. * generated/_log_c17.F90: New file. * generated/_log_r17.F90: New file. * generated/_mod_r17.F90: New file. * generated/_sign_r17.F90: New file. * generated/_sin_c17.F90: New file. * generated/_sin_r17.F90: New file. * generated/_sinh_r17.F90: New file. * generated/_sqrt_c17.F90: New file. * generated/_sqrt_r17.F90: New file. * generated/_tan_r17.F90: New file. * generated/_tanh_r17.F90: New file. * generated/bessel_r17.c: New file. * generated/cshift0_c17.c: New file. * generated/cshift0_r17.c: New file. * generated/cshift1_16_c17.c: New file. * generated/cshift1_16_r17.c: New file. * generated/cshift1_4_c17.c: New file. * generated/cshift1_4_r17.c: New file. * generated/cshift1_8_c17.c: New file. * generated/cshift1_8_r17.c: New file. * generated/findloc0_c17.c: New file. * generated/findloc0_r17.c: New file. * generated/findloc1_c17.c: New file. * generated/findloc1_r17.c: New file. * generated/in_pack_c17.c: New file. * generated/in_pack_r17.c: New file. * generated/in_unpack_c17.c: New file. * generated/in_unpack_r17.c: New file. * generated/matmul_c17.c: New file. * generated/matmul_r17.c: New file. * generated/matmulavx128_c17.c: New file. * generated/matmulavx128_r17.c: New file. * generated/maxloc0_16_r17.c: New file. * generated/maxloc0_4_r17.c: New file. * generated/maxloc0_8_r17.c: New file. * generated/maxloc1_16_r17.c: New file. * generated/maxloc1_4_r17.c: New file. * generated/maxloc1_8_r17.c: New file. * generated/maxval_r17.c: New file. * generated/minloc0_16_r17.c: New file. * generated/minloc0_4_r17.c: New file. * generated/minloc0_8_r17.c: New file. * generated/minloc1_16_r17.c: New file. * generated/minloc1_4_r17.c: New file. * generated/minloc1_8_r17.c: New file. * generated/minval_r17.c: New file. * generated/norm2_r17.c: New file. * generated/pack_c17.c: New file. * generated/pack_r17.c: New file. * generated/pow_c17_i16.c: New file. * generated/pow_c17_i4.c: New file. * generated/pow_c17_i8.c: New file. * generated/pow_r17_i16.c: New file. * generated/pow_r17_i4.c: New file. * generated/pow_r17_i8.c: New file. * generated/product_c17.c: New file. * generated/product_r17.c: New file. * generated/reshape_c17.c: New file. * generated/reshape_r17.c: New file. * generated/spread_c17.c: New file. * generated/spread_r17.c: New file. * generated/sum_c17.c: New file. * generated/sum_r17.c: New file. * generated/unpack_c17.c: New file. * generated/unpack_r17.c: New file. libiberty/ChangeLog: * aclocal.m4: Regenerate. * configure: Regenerate. libitm/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: libquadmath/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. libsanitizer/ChangeLog: * Makefile.in: Regenerate. * asan/Makefile.in: Regenerate. * configure: Regenerate. Regenerate. * hwasan/Makefile.in: Regenerate. * interception/Makefile.in: Regenerate. * libbacktrace/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. libssp/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. Regenerate. lto-plugin/ChangeLog: * Makefile.in: Regenerate. zlib/ChangeLog: * configure: Regenerate. Regenerate.
* c++: Avoid adding implicit attributes during apply_late_template_attributes ↵Jakub Jelinek2021-11-192-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [PR101180] decl_attributes and its caller cplus_decl_attributes sometimes add implicit attributes, e.g. optimize attribute if #pragma GCC optimize is active, target attribute if #pragma GCC target is active, or e.g. omp declare target attribute if in between #pragma omp declare target and #pragma omp end declare target. For templates that seems highly undesirable to me though, they should get those implicit attributes from the spot the templates were parsed (and they do get that), then tsubst through copy_node copies those attributes, but then apply_late_template_attributes can or does add a new set from the spot where they are instantiated, which can be pretty random point of first use of the template. Consider e.g. #pragma GCC push_options #pragma GCC target "avx" template <int N> inline void foo () { } #pragma GCC pop_options #pragma GCC push_options #pragma GCC target "crc32" void bar () { foo<0> (); } #pragma GCC pop_options testcase where the intention is that foo has avx target attribute and bar has crc32 target attribute, but we end up with __attribute__((target ("crc32"), target ("avx"))) on foo<0> (and due to yet another bug actually don't enable avx in foo<0>). In this particular case it is a regression caused by r12-299-ga0fdff3cf33f7284 which apparently calls cplus_decl_attributes even if attributes != NULL but late_attrs is NULL, before those changes we didn't call it in those cases. But, if there is at least one unrelated dependent attribute this would happen already in older releases. The following patch fixes that by temporarily overriding the variables that control the addition of the implicit attributes. Shall we also change the function so that it doesn't call cplus_decl_attributes if late_attrs is NULL, or was that change intentional? 2021-11-19 Jakub Jelinek <jakub@redhat.com> PR c++/101180 * pt.c (apply_late_template_attributes): Temporarily override current_optimize_pragma, optimization_current_node, current_target_pragma and scope_chain->omp_declare_target_attribute, so that cplus_decl_attributes doesn't add implicit attributes. * g++.target/i386/pr101180.C: New test.
* gcc, doc: Fix Darwin bootstrap: Amend an @option command to elide a space.Iain Sandoe2021-11-191-1/+1
| | | | | | | | | | | | | | At least some version(s) of makeinfo (4.8) do not like @option {-xxxx} the brace has to follow the @option without any whitespace. makeinfo 4.8 is installed on Darwin systems and this breaks bootstrap. The amendment follows the style of the surrounding code. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * doc/invoke.texi: Remove whitespace after an @option.
* analyzer: fix false leak due to overeager state merging [PR103217]David Malcolm2021-11-199-14/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR analyzer/103217 reports a false positive from -Wanalyzer-malloc-leak. The root cause is due to overzealous state merger, where the state-merging code decided to merge these two states by merging the stores: state A: clusters within frame: ‘main’@1 cluster for: one_3: CONJURED(val_4 = strdup (src_2(D));, val_4) cluster for: two_4: UNKNOWN(char *) cluster for: one_21: CONJURED(val_4 = strdup (src_2(D));, val_4) state B: clusters within frame: ‘main’@1 cluster for: one_3: UNKNOWN(char *) cluster for: two_4: CONJURED(val_4 = strdup (src_2(D));, val_4) cluster for: two_18: CONJURED(val_4 = strdup (src_2(D));, val_4) into: clusters within frame: ‘main’@1 cluster for: one_3: UNKNOWN(char *) cluster for: two_4: UNKNOWN(char *) cluster for: one_21: UNKNOWN(char *) cluster for: two_18: UNKNOWN(char *) despite "CONJURED(val_4 = strdup (src_2(D));, val_4)" having sm-state, in this case malloc:nonnull ({free}), thus leading to both references to the conjured svalue being lost at merger. This patch tweaks the state merger code so that it will not consider merging two different svalues for the value of a region if either svalue has non-purgable sm-state (in the above example, malloc:nonnull). This fixes the false leak report above. Doing so uncovered an issue with explode-2a.c in which the warnings moved from the correct location to the "while" stmt. This turned out to be a missing call to detect_leaks in phi-handling, which the patch also fixes (in the PK_BEFORE_SUPERNODE case in exploded_graph::process_node). Doing this fixed the regression in explode-2a.c and also fixed the location of the leak warning in explode-1.c. The other side effect of the change is that pr94858-1.c now emits a -Wanalyzer-too-complex warning, since pertinent state is no longer being thrown away. There doesn't seem to be a good way of avoiding this, so the patch also adds -Wno-analyzer-too-complex to that test case (restoring the default). gcc/analyzer/ChangeLog: PR analyzer/103217 * engine.cc (exploded_graph::get_or_create_node): Pass in m_ext_state to program_state::can_merge_with_p. (exploded_graph::process_worklist): Likewise. (exploded_graph::maybe_process_run_of_before_supernode_enodes): Likewise. (exploded_graph::process_node): Add missing call to detect_leaks when handling phi nodes. * program-state.cc (program_state::can_merge_with_p): Add "ext_state" param. Pass it and state ptrs to region_model::can_merge_with_p. (selftest::test_program_state_merging): Update for new ext_state param of program_state::can_merge_with_p. (selftest::test_program_state_merging_2): Likewise. * program-state.h (program_state::can_purge_p): Make const. (program_state::can_merge_with_p): Add "ext_state" param. * region-model.cc: Include "analyzer/program-state.h". (region_model::can_merge_with_p): Add params "ext_state", "state_a", and "state_b", use them when creating model_merger object. (model_merger::mergeable_svalue_p): New. * region-model.h (region_model::can_merge_with_p): Add params "ext_state", "state_a", and "state_b". (model_merger::model_merger) Likewise, initializing new fields. (model_merger::mergeable_svalue_p): New decl. (model_merger::m_ext_state): New field. (model_merger::m_state_a): New field. (model_merger::m_state_b): New field. * svalue.cc (svalue::can_merge_p): Call model_merger::mergeable_svalue_p on both states and reject the merger accordingly. gcc/testsuite/ChangeLog: PR analyzer/103217 * gcc.dg/analyzer/explode-1.c: Update for improvement to location of leak warning. * gcc.dg/analyzer/pr103217.c: New test. * gcc.dg/analyzer/pr94858-1.c: Add -Wno-analyzer-too-complex. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
* libstdc++: Improve tests for stringstream constructors in C++20Jonathan Wakely2021-11-196-88/+633
| | | | | | | | | | | | | | | | | This ensures all constructors are checked. libstdc++-v3/ChangeLog: * testsuite/27_io/basic_istringstream/cons/char/1.cc: Check all constructors. * testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise. * testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc: Likewise.
* libstdc++: Use __is_single_threaded in locale initializationJonathan Wakely2021-11-191-2/+9
| | | | | | | | | | | | | | | | | | | | | | This replaces a __gthread_active_p() check with __is_single_threaded() so that std::locale initialization doesn't use __gthread_once if it happens before the first thread is created. This means that _S_initialize_once() might now be called twice instead of only once, because if __is_single_threaded() changes to false then we will do the __gthread_once call even if _S_initialize_once() was already called. Add a check to _S_initialize_once() and return immediately if it is the second call. Also use __builtin_expect to _S_initialize, as the branch will be taken at most once in the lifetime of the program. libstdc++-v3/ChangeLog: * src/c++98/locale_init.cc (_S_initialize_once): Check if initialization has already been done. (_S_initialize): Replace __gthread_active_p with __is_single_threaded. Use __builtin_expect.
* libstdc++: One more change for Clang to support constexpr std::string [PR103295]Jonathan Wakely2021-11-191-1/+1
| | | | | | | | | | | All writes into the allocated buffer need to be via traits_type::assign to begin lifetimes. libstdc++-v3/ChangeLog: PR libstdc++/103295 * include/bits/basic_string.tcc (_M_construct): Use the traits assign member to write into allcoated memory.
* rs6000: Add optimizations for _mm_sad_epu8Paul A. Clarke2021-11-191-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Power9 ISA added `vabsdub` instruction which is realized in the `vec_absd` instrinsic. Use `vec_absd` for `_mm_sad_epu8` compatibility intrinsic, when `_ARCH_PWR9`. Also, the realization of `vec_sum2s` on little-endian includes two rotates in order to position the input and output to match the semantics of `vec_sum2s`: - Rotate the second input vector left 12 bytes. In the current usage, that vector is `{0}`, so this shift is unnecessary, but is currently not eliminated under optimization. - Rotate the vector produced by the `vsum2sws` instruction left 4 bytes. The two words within each doubleword of this (rotated) result must then be explicitly swapped to match the semantics of `_mm_sad_epu8`, effectively reversing this rotate. So, this rotate (and a susequent swap) are unnecessary, but not currently removed under optimization. Using `__builtin_altivec_vsum2sws` retains both rotates, so is not an option for removing the rotates. For little-endian, use the `vsum2sws` instruction directly, and eliminate the explicit rotate (swap). 2021-11-19 Paul A. Clarke <pc@us.ibm.com> gcc * config/rs6000/emmintrin.h (_mm_sad_epu8): Use vec_absd when _ARCH_PWR9, optimize vec_sum2s when LE.
* c++: Fix cpp0x/lambda/lambda-nested9.C with C++11Marek Polacek2021-11-191-1/+1
| | | | | | | | | | | | | Unfortunately dejagnu doesn't honor #if/#endif, so this test was failing with -std=c++11: FAIL: g++.dg/cpp0x/lambda/lambda-nested9.C -std=c++11 (test for errors, line 37) Fixed thus. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-nested9.C: Adjust dg-error.
* Darwin: Rework handling for unwinder code in libgcc_s and specs [PR80556].Iain Sandoe2021-11-1918-581/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses a long-standing problem where a work-around for an unwinder issue (also a regression) regresses other functionality. The patch replaces several work-arounds with a fix for PR80556 and a work-around for PR88590. * The fix for PR80556 requires a bump to the SO name for libgcc_s, since we need to remove the unwinder symbols from it. This would trigger PR88590 hence the work-around for that. * We weaken the symbols for emulated TLS support so that it is possible for a DSO linked with static-libgcc to interoperate with a DSO linked with libgcc_s. Likewise main exes. * We remove all the gcc-4.2.1 era stubs machinery and workarounds. * libgcc is always now linked ahead of libc, which avoids fails where the libc (libSystem) builtins implementations are not up to date. * The unwinder now always comes from the system - for Darwin9 from /usr/lib/libgcc_s.1.dylib - for Darwin10 from /usr/lib/libSystem.dylib - for Darwin11+ from /usr/lib/system/libunwind.dylib. We still insert a shim on Darwin10 to fix an omitted unwind function, but the underlying unwinder remains the system one. * The work-around for PR88590 has two parts (1) we always link libgcc from its convenience lib on affected system versions (avoiding the need to find the DSO path); (2) we add and export the emutls functions from DSOs - this makes a relatively small (20k) addition to a DSO. These can be backed out when a proper fix for PR88590 is committed. For distributions that wish to install a libgcc_s.1.dylib to satisfy linkage from exes that linked against the stubs can use a reexported libgcc_s.1.1 (since that contains all the symbols that were previously exported via the stubs). Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: PR target/80556 * config/darwin-driver.c (darwin_driver_init): Handle exported symbols and symbol lists (suppress automatic export of the TLS symbols). * config/darwin.c (darwin_rename_builtins): Remove workaround. * config/darwin.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. (REAL_LIBGCC_SPEC): Handle revised library uses. * config/darwin.opt (nodefaultexport): New. * config/i386/darwin.h (PR80556_WORKAROUND): Remove. * config/i386/darwin32-biarch.h (PR80556_WORKAROUND): Likewise. * config/i386/darwin64-biarch.h (PR80556_WORKAROUND): Likewise. libgcc/ChangeLog: * config.host: Add weak emutls crt to the extra_parts. * config/i386/darwin-lib.h (DECLARE_LIBRARY_RENAMES): Remove workaround. * config/libgcc-libsystem.ver: Add exclude list for the system- provided unwinder. * config/t-slibgcc-darwin: Bump SO version, remove stubs code. * config/i386/libgcc-darwin.10.4.ver: Removed. * config/i386/libgcc-darwin.10.5.ver: Removed. * config/rs6000/libgcc-darwin.10.4.ver: Removed. * config/rs6000/libgcc-darwin.10.5.ver: Removed. * config/t-darwin-noeh: New file. gcc/testsuite/ChangeLog: * gcc.dg/torture/fp-int-convert-timode-3.c: Remove XFAIL. * gcc.dg/torture/fp-int-convert-timode-4.c: Likewise.
* libgcc, emutls: Allow building weak definitions of the emutls functions.Iain Sandoe2021-11-192-2/+28
| | | | | | | | | | | | | | | In order to better support use of the emulated TLS between objects with DSO dependencies and static-linked libgcc, allow a target to make weak definitions. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libgcc/ChangeLog: * config/t-darwin: Build weak-defined emutls objects. * emutls.c (__emutls_get_address): Add optional attributes. (__emutls_register_common): Likewise. (EMUTLS_ATTR): New.
* libstdc++, testsuite: Add a prune expression for external tool bug.Iain Sandoe2021-11-191-1/+4
| | | | | | | | | | | | | | Depending on the permutation of CPU, OS version and shared/non- shared library inclusion, we get can get warnings from the external tools (ld64, dsymutil) which are not actually libstdc++ issues but relate to the external tools themselves. This is already pruned in the main testsuite, this adds it to the library. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libstdc++-v3/ChangeLog: * testsuite/lib/prune.exp: Prune dsymutil (ld64) warning.
* libphobos, testsuite: Add prune clauses for two Darwin cases.Iain Sandoe2021-11-191-0/+7
| | | | | | | | | | | | | | | Depending on the permutation of CPU, OS version and shared/non- shared library inclusion, we get can get two warnings from the external tools (ld64, dsymutil) which are not actually GCC issues but relate to the external tools. These are alrrady pruned in the main testsuite, this adds them to the library. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libphobos/ChangeLog: * testsuite/lib/libphobos.exp: Prune warnings from external tool bugs.
* libstdc++: Suppress -Wstringop warnings [PR103332]Jonathan Wakely2021-11-193-1/+9
| | | | | | | | | | | | | libstdc++-v3/ChangeLog: PR libstdc++/103332 PR libstdc++/102958 * testsuite/21_strings/basic_string/capacity/char/1.cc: Add -Wno-stringop-overflow. * testsuite/21_strings/basic_string/operators/char/1.cc: Likewise. * testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc: Add -Wno-stringop-overread.
* libstdc++: Begin lifetime of chars in constexpr std::string [PR103295]Jonathan Wakely2021-11-196-15/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang gives errors for constexpr std::string because the memory returned by std::allocator<T>::allocate does not contain any objects yet, and attempting to set them using char_traits::assign or char_traits::copy fails with: assignment to object outside its lifetime is not allowed in a constant expression *__result = *__first; ^ This adds code to std::char_traits to use std::construct_at to begin lifetimes when called during constant evaluation. To support specializations of std::basic_string that don't use std::char_traits there is now another layer of wrapper around the allocator_traits, so that the lifetime of characters is begun as soon as the memory is allocated. By doing it in the char traits and allocator traits, the rest of basic_string can ignore the problem. While modifying char_traits::copy and char_traits::assign to begin lifetimes for the constexpr cases, I also replaced their uses of std::copy and std::fill_n respectively. That means we don't need <bits/stl_algobase.h> for char_traits. libstdc++-v3/ChangeLog: PR libstdc++/103295 * include/bits/basic_string.h (_Alloc_traits): Replace typedef with struct for C++20 mode. * include/bits/basic_string.tcc (_M_replace): Use _Alloc_traits for allocation. * include/bits/char_traits.h (__gnu_cxx::char_traits::assign): Use std::_Construct during constant evaluation. (__gnu_cxx::char_traits::assign(CharT*, const CharT*, size_t)): Likewise. Replace std::fill_n with memset or manual loop. (__gnu_cxx::char_traits::copy): Likewise, replacing std::copy with memcpy. * include/ext/vstring.h: Include <bits/stl_algobase.h> for std::min. * include/std/string_view: Likewise. * testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc: Add constexpr test.
* options: Make -Ofast switch off -fsemantic-interpositionMartin Jambor2021-11-192-0/+2
| | | | | | | | | | | | | | | | | | | | | Using -fno-semantic-interposition has been reported by various people to bring about considerable speed up at the cost of strict compliance to the ELF symbol interposition rules See for example https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup As such I believe it should be implied by our -Ofast optimization level, not only so that benchmarks that can benefit run faster, but also so that people looking at -Ofast documentation for options that could speed their programs find it. gcc/ChangeLog: 2021-11-12 Martin Jambor <mjambor@suse.cz> * opts.c (default_options_table): Switch off flag_semantic_interposition at Ofast. * doc/invoke.texi (Optimize Options): Document that Ofast switches off -fsemantic-interposition.
* Use modref even for nested functions in ref_maybe_used_by_call_p_1Jan Hubicka2021-11-192-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Remove test for function not having call chain guarding modref use in ref_maybe_used_by_call_p_1. It never made sense since modref treats call chain accesses explicitly. It was however copied from earlier check for ECF_CONST (which seems dubious too, but I would like to discuss it independelty). This enables us to detect that memory pointed to static chain (or parts of it) are unused by the function. lto-bootstrapped-regtested all lanugages on x86_64-linux. gcc/ChangeLog: 2021-11-19 Jan Hubicka <hubicka@ucw.cz> * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Do not guard modref by !gimple_call_chain. gcc/testsuite/ChangeLog: 2021-11-19 Jan Hubicka <hubicka@ucw.cz> * gcc.dg/tree-ssa/modref-dse-6.c: New test.
* Restore ancient -Waddress for weak symbols [PR33925].Martin Sebor2021-11-1910-11/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolves: PR c/33925 - gcc -Waddress lost some useful warnings PR c/102867 - -Waddress from macro expansion in readelf.c gcc/c-family/ChangeLog: PR c++/33925 PR c/102867 * c-common.c (decl_with_nonnull_addr_p): Call maybe_nonzero_address and improve handling tof defined symbols. gcc/c/ChangeLog: PR c++/33925 PR c/102867 * c-typeck.c (maybe_warn_for_null_address): Suppress warnings for code resulting from macro expansion. gcc/cp/ChangeLog: PR c++/33925 PR c/102867 * typeck.c (warn_for_null_address): Suppress warnings for code resulting from macro expansion. gcc/ChangeLog: PR c++/33925 PR c/102867 * doc/invoke.texi (-Waddress): Update. gcc/testsuite/ChangeLog: PR c++/33925 PR c/102867 * g++.dg/warn/Walways-true-2.C: Adjust to avoid a valid warning. * c-c++-common/Waddress-5.c: New test. * c-c++-common/Waddress-6.c: New test. * g++.dg/warn/Waddress-7.C: New test. * gcc.dg/Walways-true-2.c: Adjust to avoid a valid warning. * gcc.dg/weak/weak-3.c: Expect a warning.
* Limit depth for all GORI expressions.Andrew MacLeod2021-11-192-11/+34
| | | | | | | | | | | | | Apply the logical_depth limit ranger uses to all stmts with multiple ssa-names to avoid excessive outgoing calculations. gcc/ PR tree-optimization/103254 * gimple-range-gori.cc (range_def_chain::get_def_chain): Limit the depth for all statements with multple ssa names. gcc/testsuite/ * gcc.dg/pr103254.c: New.
* IBM Z: Fix load-and-test peephole2 conditionStefan Schulze Frielinghaus2021-11-192-1/+13
| | | | | | | | | | | | | | | | For a peephole2 condition variable insn points to the first matched insn. In order to refer to the second matched insn use peep2_next_insn(1) instead. gcc/ChangeLog: * config/s390/s390.md (define_peephole2): Variable insn points to the first matched insn. Use peep2_next_insn(1) to refer to the second matched insn. gcc/testsuite/ChangeLog: * gcc.target/s390/20211119.c: New test.
* middle-end: Handle FMA_CONJ correctly after SLP layout update.Tamar Christina2021-11-198-26/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apologies, I got dinged by the i386 regressions bot for a test I didn't have in my tree at the time I made the previous patch. The bot was telling me that FMA stopped working after I strengthened the FMA check in the previous patch. The reason is that the check is slightly early. The first check can indeed only exit early when either node isn't a mult. However we need to delay till we know if the node is a MUL or FMA before enforcing that both nodes must be a MULT since the node to inspect is different if the operation is a MUL or FMA. Also with the update patch for GCC 11 tree layout update to the new GCC 12 one I had missed that the difference in which node is conjucated is not symmetrical. So the test for it can just be testing the inverse order. It was Currently no detecting when the first node was conjucated instead of the second one. This also made me wonder why my own test didn't detect this. It turns out that the tests, being copied from the _Float16 ones were incorrectly marked as xfail. The _Float16 ones are marked as xfail since C doesn't have a conj operation for _Float16, which means you get extra type-casts in between. While you could use the GCC _Complex extension here I opted to mark them xfail since I wanted to include detection over the widenings next year. Secondly the double tests were being skipped because Adv. SIMD was missing from targets supporting Complex Double vectorization. With these changes all other tests run and pass and only XFAIL ones are correctly the _Float16 ones. Sorry for missing this before, testing should now cover all cases. gcc/ChangeLog: PR tree-optimization/103311 PR target/103330 * tree-vect-slp-patterns.c (vect_validate_multiplication): Fix CONJ test to new codegen. (complex_mul_pattern::matches): Move check downwards. gcc/testsuite/ChangeLog: PR tree-optimization/103311 PR target/103330 * gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-double.c: Fix it. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-float.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-double.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-float.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-double.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c: Likewise. * lib/target-supports.exp (check_effective_target_vect_complex_add_double): Add Adv. SIMD.
* Revert "Remove MAY_HAVE_DEBUG_MARKER_STMTS and MAY_HAVE_DEBUG_BIND_STMTS."Martin Liska2021-11-1927-41/+46
| | | | This reverts commit 206b22d021d94adbaa79e1d443c87415254b15de.
* Do not abort compilation when dump file is /dev/*Giuliano Belinassi2021-11-193-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `configure` scripts generated with autoconf often tests compiler features by setting output to `/dev/null`, which then sets the dump folder as being /dev/* and the compilation halts with an error because GCC cannot create files in /dev/. This is a problem when configure is testing for compiler features because it cannot tell if the failure was due to unsupported features or any other problem, and disable it even if it is working. As an example, running configure overriding CFLAGS="-fdump-ipa-clones" will result in several compiler-features as being disabled because of gcc halting with an error creating files in /dev/*. This commit fixes this issue by checking if the output file is /dev/null or /dev/zero. In this case we use the current working directory for dump output instead of the directory of the output file because we cannot write to /dev/*. gcc/ChangeLog 2021-11-16 Giuliano Belinassi <gbelinassi@suse.de> * gcc.c (process_command): Skip dumpdir override if file is a not_actual_file_p. * doc/invoke.texi: Update -dumpdir documentation. gcc/testsuite/ChangeLog 2021-11-16 Giuliano Belinassi <gbelinassi@suse.de> * gcc.dg/devnull-dump.c: New. Signed-off-by: Giuliano Belinassi <gbelinassi@suse.de>
* c++: cp_walk_subtrees simplification for *_CAST_EXPRPatrick Palka2021-11-191-7/+0
| | | | | | | | | Let walk_tree_1 do the operand walking for us. gcc/cp/ChangeLog: * tree.c (cp_walk_subtrees) <case *_CAST_EXPR>: Don't explicitly walk the operands.
* c++: nested lambda capturing a capture proxy [PR94376]Patrick Palka2021-11-192-4/+56
| | | | | | | | | | | | | | | | | | | | | | | | Here when determining the type of the FIELD_DECL for the by-value capture of 'i' in the inner lambda, we incorrectly give it the type const int instead of int since the effective initializer is the proxy for the outer capture, and this proxy is const since the outer lambda is non-mutable. This patch fixes this by making lambda_capture_field_type handle by-value capturing of capture proxies specially, namely we instead consider the type of their FIELD_DECL which unlike the proxy has the true cv-quals of the captured entity. PR c++/94376 gcc/cp/ChangeLog: * lambda.c (lambda_capture_field_type): Simplify by handling the is_this case first. When capturing by-value a capture proxy, consider the type of the corresponding field instead. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-nested9.C: New test.
* libphobos: Increase size of defaultStackPages on OSX X86_64 targets.Iain Buclaw2021-11-191-0/+10
| | | | | | | | | | | As of macOS 11, libunwind now requires more stack space than 16k, so default to a larger stack size. This is only applied to X86 as the PAGESIZE is still 4k, however on AArch64 it is 16k. libphobos/ChangeLog: * libdruntime/core/thread/fiber.d (defaultStackPages): Increase size on OSX X86_64 targets.
* libphobos: Don't call __gthread_key_delete in the emutls destroy function.Iain Buclaw2021-11-191-6/+0
| | | | | | | | | | | | Fixes a EXC_BAD_ACCESS issue seen on Darwin when the libphobos DSO gets unloaded. Based on reading libgcc's emutls implementation, as it doesn't call __gthread_key_delete directly, neither should libphobos. libphobos/ChangeLog: * libdruntime/gcc/emutls.d (emutlsDestroyThread): Don't remove entry from global array. (_d_emutls_destroy): Don't call __gthread_key_delete.
* Fix tree-optimization/103314 : Limit folding of (type) X op CST where type ↵Andrew Pinski2021-11-192-1/+11
| | | | | | | | | | | | | | | | | | | | | | is a nop convert to gimple There is some re-association code in fold_binary which conflicts with this optimization due keeping around some "constants" which are not INTEGER_CST (1 << -1) so we end up in an infinite loop because of that. So we need to limit this case to GIMPLE level only. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/103314 gcc/ChangeLog: * match.pd ((type) X op CST): Restrict the equal TYPE_PRECISION case to GIMPLE only. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr103314-1.c: New test.
* Fix IPA modref ubsan.Martin Liska2021-11-192-2/+6
| | | | | | | | | | | | | | | | | | | modref_tree<tree_node*>::merge(modref_tree<tree_node*>*, vec<modref_parm_map, va_heap, vl_ptr>*, modref_parm_map*, bool) is called with modref_parm_map chain_map; The variable has uninitialized m.parm_offset_known and it is accessed here: gcc/ipa-modref-tree.h:572 a.parm_offset_known &= m.parm_offset_known; PR ipa/103230 gcc/ChangeLog: * ipa-modref-tree.h (struct modref_parm_map): Add default constructor. * ipa-modref.c (ipa_merge_modref_summary_after_inlining): Use it.
* c++/103326 - fix ICE in tsubst with VECTOR_CSTRichard Biener2021-11-192-0/+16
| | | | | | | | | | | This adds missing handling of VECTOR_CST. 2021-11-19 Richard Biener <rguenther@suse.de> PR c++/103326 * pt.c (tsubst_copy): Handle VECTOR_CST. * g++.dg/pr103326.C: New testcase.