From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B959B3858D38; Tue, 16 Jan 2024 20:44:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B959B3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705437884; bh=2Dk4IXzd8pq/OfvjpxOU9k7mPpXkD2aphXxRZuJYoKw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YK/L+5hfqAHWX3wgdZoeVzKGirUxFKUrks6MZolmyfe+QoVJZem5fsbXQwaLiM7Tf 3su3IupMzSi4RB9oGaU/xzJ0McktPxFqJB0AHdNlo5PxD4DeKohvJGs1r7v2/p8Xf2 OB4EnDgLt6yB0elf799pa9/cCYrwEq4Ls9eipLwg= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/113412] ATAN(Y,X) does not check arguments and generates wrong error message. Date: Tue, 16 Jan 2024 20:44:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113412 --- Comment #2 from kargl at gcc dot gnu.org --- With the patch at the end of this message and this source code, program foo integer(8) x real(8) y, z x =3D 1 y =3D x z =3D atan(y,x) print *, z end I get=20 % gfcx -c a.f90 a.f90:6:14: 6 | z =3D atan(y,x) | 1 Error: 'x' argument of 'atan' intrinsic at (1) must be the same type and ki= nd as 'x' which is almost correct (one of 'x' should be 'y'). diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc index c35f2bdd183..c30165dacef 100644 --- a/gcc/fortran/intrinsic.cc +++ b/gcc/fortran/intrinsic.cc @@ -4371,7 +4371,10 @@ sort_actual (const char *name, gfc_actual_arglist **= ap, goto do_sort; whoops: - gfc_error ("Too many arguments in call to %qs at %L", name, where); + if (strncmp(name, "atan", 4) =3D=3D 0) + gfc_check_atan_2 ((*ap)->expr, (*ap)->next->expr); + else + gfc_error ("Too many arguments in call to %qs at %L", name, where); return false; keywords:=