public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33289]  New: [4.2/4.3 Regression] __sprintf_chk etc. not DECL_ANTICIPATED
@ 2007-09-03  8:37 jakub at gcc dot gnu dot org
  2007-09-05 23:27 ` [Bug c++/33289] " jakub at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-03  8:37 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-03-30 22:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-03  8:37 [Bug c++/33289] New: [4.2/4.3 Regression] __sprintf_chk etc. not DECL_ANTICIPATED jakub at gcc dot gnu dot org
2007-09-05 23:27 ` [Bug c++/33289] " jakub at gcc dot gnu dot org
2007-09-10 22:39 ` [Bug c++/33289] [4.2 " pinskia at gcc dot gnu dot org
2007-09-25  9:52 ` jakub at gcc dot gnu dot org
2007-09-28  4:03 ` mmitchel at gcc dot gnu dot org
2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
2008-02-01 17:05 ` jsm28 at gcc dot gnu dot org
2008-03-11  3:26 ` cnstar9988 at gmail dot com
2008-05-19 20:28 ` jsm28 at gcc dot gnu dot org
2009-03-30 22:17 ` jsm28 at gcc dot gnu dot org

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).