https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113152
--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:e8fdd55ec907496ff3c80fed55d8da3ddbdc1a2b commit r16-938-ge8fdd55ec907496ff3c80fed55d8da3ddbdc1a2b Author: Yuao Ma <c...@outlook.com> Date: Wed May 28 23:13:45 2025 +0800 fortran: add constant input support for trig functions with half-revolutions This patch introduces constant input support for trigonometric functions, including those involving half-revolutions. Both valid and invalid inputs have been thoroughly tested, as have mpfr versions greater than or equal to 4.2 and less than 4.2. Inspired by Steve's previous work, this patch also fixes subtle bugs revealed by newly added test cases. If this patch is merged, I plan to work on middle-end optimization support for previously added GCC built-ins and libgfortran intrinsics. PR fortran/113152 gcc/fortran/ChangeLog: * gfortran.h (enum gfc_isym_id): Add new enum. * intrinsic.cc (add_functions): Register new intrinsics. Changing the call from gfc_resolve_trigd{,2} to gfc_resolve_trig{,2}. * intrinsic.h (gfc_simplify_acospi, gfc_simplify_asinpi, gfc_simplify_asinpi, gfc_simplify_atanpi, gfc_simplify_atan2pi, gfc_simplify_cospi, gfc_simplify_sinpi, gfc_simplify_tanpi): New. (gfc_resolve_trig): Rename from gfc_resolve_trigd. (gfc_resolve_trig2): Rename from gfc_resolve_trigd2. * iresolve.cc (gfc_resolve_trig): Rename from gfc_resolve_trigd. (gfc_resolve_trig2): Rename from gfc_resolve_trigd2. * mathbuiltins.def: Add 7 new math builtins and re-align. * simplify.cc (gfc_simplify_acos, gfc_simplify_asin, gfc_simplify_acosd, gfc_simplify_asind): Revise error message. (gfc_simplify_acospi, gfc_simplify_asinpi, gfc_simplify_asinpi, gfc_simplify_atanpi, gfc_simplify_atan2pi, gfc_simplify_cospi, gfc_simplify_sinpi, gfc_simplify_tanpi): New. gcc/testsuite/ChangeLog: * gfortran.dg/dec_math_3.f90: Test invalid input. * gfortran.dg/dec_math_5.f90: Test valid output. * gfortran.dg/dec_math_6.f90: New test. Signed-off-by: Yuao Ma <c...@outlook.com> Co-authored-by: Steven G. Kargl <ka...@gcc.gnu.org>