[Bug c++/63789] New: g++ -m32 on solaris has trouble finding abs with int64_t
richard at netbsd dot org
gcc-bugzilla@gcc.gnu.org
Sun Nov 9 10:40:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63789
Bug ID: 63789
Summary: g++ -m32 on solaris has trouble finding abs with
int64_t
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard at netbsd dot org
with the following simplified test program (tabs.cc):
==================>8===============
#include <stdint.h>
#include <stdlib.h>
int64_t tabs(int64_t foo)
{
return abs(foo);
}
=================>8================
building with g++ -m32 -c tabs.cc gives the following error:
>tabs.cc: In function ‘int64_t tabs(int64_t)’:
>tabs.cc:6:16: error: call of overloaded ‘abs(int64_t&)’ is ambiguous
> return abs(foo);
> ^
>tabs.cc:6:16: note: candidates are:
>In file included from /usr/include/stdlib.h:37:0,
> from tabs.cc:2:
>/usr/include/iso/stdlib_iso.h:165:16: note: long int std::abs(long int)
> inline long abs(long _l) { return labs(_l); }
> ^
>/usr/include/iso/stdlib_iso.h:119:12: note: int std::abs(int)
> extern int abs(int);
> ^
there is no error specifying -m64.
Also, copying tabs.cc to tabs.c and building with gcc gives no error either
('gcc -m32 -c tabs.c' or to be pedantic with -std=c99 added).
I should mention that this seems to work okay with gcc4.4.4, but reproducible
with the compilers accessible, namely gcc47..gcc49.
The test program seems to work fine on NetBSD and FreeBSD.
This platform is SunOS 5.11 (illumos).
More information about the Gcc-bugs
mailing list