Bug 7099 - G++ doesn't set the noreturn attribute on std::exit and std::abort
Summary: G++ doesn't set the noreturn attribute on std::exit and std::abort
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2002-06-21 08:36 UTC by Kaveh Ghazi
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kaveh Ghazi 2002-06-21 08:36:00 UTC
G++ doesn't set the noreturn attribute on std::exit and std::abort.  This results in missed optimizations and spurious warnings.  For a testcase see: http://gcc.gnu.org/ml/gcc-patches/2002-06/msg01629.html

Release:
gcc version 3.2 20020620 (experimental)

Environment:
all
Comment 1 Roger Sayle 2002-07-05 20:06:57 UTC
State-Changed-From-To: open->closed
State-Changed-Why: This PR should now be fixed on mainline.  See the audit
    trail in GNAT for the relevant ChangeLog entries.  Thanks
    to Jeff Law and Mark Mitchell for reviewing the relevant
    patches, and Kaveh Ghazi for the testcase.
Comment 2 Roger Sayle 2002-07-06 00:16:46 UTC
From: sayle@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7099
Date: 6 Jul 2002 00:16:46 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	sayle@gcc.gnu.org	2002-07-05 17:16:45
 
 Modified files:
 	gcc            : ChangeLog builtin-attrs.def builtins.def tree.h 
 	                 builtins.c c-common.c 
 	gcc/doc        : extend.texi 
 	gcc/java       : ChangeLog builtins.c 
 
 Log message:
 	PR c++/7099
 	* builtin-attrs.def: Define new attribute lists for use in
 	builtins.def.
 	* builtins.def [DEF_BUILTIN]: Modify to take an additional
 	ATTRS argument, an enumerated value defined in builtin-attrs.def
 	that represents the attribute list for the builtins.  Modify
 	all builtin functions to pass an appropriate attribute list.
 	Specify "abort", "exit", "_exit" and "_Exit" builtins here with
 	their required noreturn attributes.
 	* tree.h (enum_builtin_function): Ignore the additional parameter
 	to DEF_BUILTIN.
 	* builtins.c (built_in_names): Likewise.
 	* c-common.c: (builtin_function_2): Replace the "int noreturn_p"
 	argument with a tree representing the functions attribute list.
 	Pass this "attrs" argument to builtin_function.  No longer handle
 	the noreturn_p processing manually.
 	(built_in_attributes): Move the definitions from builtin-attrs.def
 	before c_common_nodes_and_builtins.
 	(c_common_nodes_and_builtins): Handle the new ATTRS parameter in
 	DEF_BUILTIN, passing it to both builtin_function and the changed
 	builtin_function_2.
 	
 	* doc/extend.texi: Document __builtin_abort, __builtin_exit,
 	__builtin__exit and __builtin__Exit.
 	
 	* java/builtins.c (initialize_builtins): Ignore the additional
 	parameter to DEF_BUILTIN.  Handle more C/C++ specific junk in
 	the builtins.def file.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.14790&r2=1.14791
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtin-attrs.def.diff?cvsroot=gcc&r1=1.3&r2=1.4
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.def.diff?cvsroot=gcc&r1=1.29&r2=1.30
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.344&r2=1.345
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.152&r2=1.153
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.346&r2=1.347
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.87&r2=1.88
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1027&r2=1.1028
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/builtins.c.diff?cvsroot=gcc&r1=1.8&r2=1.9
 

Comment 3 Roger Sayle 2002-07-06 00:25:32 UTC
From: sayle@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7099
Date: 6 Jul 2002 00:25:32 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	sayle@gcc.gnu.org	2002-07-05 17:25:31
 
 Modified files:
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/warn: noreturn-1.C 
 
 Log message:
 	2002-07-05  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 	
 	PR c++/7099
 	* g++.dg/warn/noreturn1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.1968&r2=1.1969
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/noreturn-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1