[Bug c++/33289] New: [4.2/4.3 Regression] __sprintf_chk etc. not DECL_ANTICIPATED
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Sep 3 08:37:00 GMT 2007
typedef __SIZE_TYPE__ size_t;
extern "C" int __sprintf_chk (char *__restrict, int, size_t, const char *, ...)
throw ();
extern "C" int __sprintf_chk (char *__restrict, int, size_t, const char *, ...)
throw ();
fails to compile with:
/tmp/4.C:3: error: declaration of 'int __sprintf_chk(char*, int, size_t, const
char*, ...) throw ()' throws different exceptions
/tmp/4.C:2: error: from previous declaration 'int __sprintf_chk(char*, int,
long unsigned int, const char*, ...)'
(but compiles with -fno-builtin-__sprintf_chk). Surprisingly, similar
testcase with say __memcpy_chk compiles just fine.
The problem is that when we create builtins,
1) ATTR_NOTHROW among builtin attributes causes just TREE_NOTHROW being set,
but doesn't create any kind of exception specification
2) the C++ FE sets DECL_ANTICIPATED only on builtins that don't start with
two underscores.
I wonder why the limitation on DECL_ANTICIPATED, I can understand that for
__builtin_* or __sync_*, but __*_chk when not __builtin___*_chk should be
IMHO DECL_ANTICIPATED.
Also, at least for Linux NOTHROW on printf, fprintf etc. is wrong, only
sprintf/snprintf can't throw, printf/fprintf/scanf etc. are (optional)
cancellation points and during pthread_cancel can cause forced unwinding.
--
Summary: [4.2/4.3 Regression] __sprintf_chk etc. not
DECL_ANTICIPATED
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33289
More information about the Gcc-bugs
mailing list