public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109492] New: gcc/fortran/trans-expr.cc:3407:17: error: call of overloaded ‘abs(long long int&)’ is ambiguous Date: Wed, 12 Apr 2023 22:09:17 +0000 [thread overview] Message-ID: <bug-109492-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109492 Bug ID: 109492 Summary: gcc/fortran/trans-expr.cc:3407:17: error: call of overloaded ‘abs(long long int&)’ is ambiguous Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: build Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- Bootstrap fails using gcc-5.5 on Solaris 2.11 (specifically, on gcc211 in the compile farm): /export/home/jwakely/src/gcc/gcc/fortran/trans-expr.cc: In function ‘void gfc_conv_power_op(gfc_se*, gfc_expr*)’: /export/home/jwakely/src/gcc/gcc/fortran/trans-expr.cc:3407:17: error: call of overloaded ‘abs(long long int&)’ is ambiguous w = abs (v); ^ In file included from /usr/include/stdlib.h:11:0, from /export/home/jwakely/src/gcc/gcc/system.h:266, from /export/home/jwakely/src/gcc/gcc/fortran/trans-expr.cc:25: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/iso/stdlib_iso.h:163:16: note: candidate: long int std::abs(long int) inline long abs(long _l) { return labs(_l); } ^ /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/include-fixed/iso/stdlib_iso.h:117:12: note: candidate: int std::abs(int) extern int abs(int); ^ gmake[1]: *** [Makefile:1157: fortran/trans-expr.o] Error 1 The problem is that the libc <stdlib.h> is not C++11-aware and so doesn't provide the long long overload of abs. It is provided by the libstdc++ <cstdlib> header, but only in namespace std. The solution is to either use std::abs (v) or to do: --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -3399,6 +3399,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) if (INTEGER_CST_P (lse.expr) && TREE_CODE (TREE_TYPE (rse.expr)) == INTEGER_TYPE) { + using std::abs; wi::tree_to_wide_ref wlhs = wi::to_wide (lse.expr); HOST_WIDE_INT v, w; int kind, ikind, bit_size; The bootstrap compiler is: Reading specs from /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.5.0/specs COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/sparc-sun-solaris2.10/5.5.0/lto-wrapper Target: sparc-sun-solaris2.10 Configured with: /home/dam/mgar/pkg/gcc5/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-5.5.0/configure --prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin --sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share --sysconfdir=/etc/opt/csw --sharedstatedir=/opt/csw/share --localstatedir=/var/opt/csw --libdir=/opt/csw/lib --infodir=/opt/csw/share/info --includedir=/opt/csw/include --mandir=/opt/csw/share/man --enable-cloog-backend=isl --enable-java-awt=xlib --enable-languages=ada,c,c++,fortran,go,java,objc --enable-libada --enable-libssp --enable-nls --enable-objc-gc --enable-threads=posix --program-suffix=-5.5 --with-cloog=/opt/csw --with-gmp=/opt/csw --with-included-gettext --with-ld=/usr/ccs/bin/ld --without-gnu-ld --with-libiconv-prefix=/opt/csw --with-mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/opt/csw --with-as=/usr/ccs/bin/as --without-gnu-as Thread model: posix gcc version 5.5.0 (GCC) This was built on solaris 2.10 so maybe the solution is just to update /opt/csw/bin/gcc. I'll ask the cfarm admins about that.
next reply other threads:[~2023-04-12 22:09 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-12 22:09 redi at gcc dot gnu.org [this message] 2023-04-12 22:13 ` [Bug fortran/109492] " redi at gcc dot gnu.org 2023-04-13 11:37 ` rguenth at gcc dot gnu.org 2023-04-13 19:03 ` anlauf at gcc dot gnu.org 2023-04-13 19:34 ` redi at gcc dot gnu.org 2023-04-13 20:47 ` cvs-commit at gcc dot gnu.org 2023-04-14 19:25 ` anlauf at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109492-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).