Testcase: missing noreturn attribute on std::abort & std::exit

Mark Mitchell mark@codesourcery.com
Wed Jun 19 13:05:00 GMT 2002



--On Wednesday, June 19, 2002 10:53:14 AM -0400 "Kaveh R. Ghazi" 
<ghazi@caip.rutgers.edu> wrote:

> G++ doesn't know that std::abort and std::exit are noreturn functions.
> If we can assume that they are, this fact results in missed
> optimization opportunities and spurious warnings as demonstrated by
> the attached testcase.  I should get zero warnings but instead I get:
>
>  > g++.dg/warn/noreturn1.C: In function `int foo2(int)':
>  > g++.dg/warn/noreturn1.C:28: warning: control reaches end of non-void
> function  > g++.dg/warn/noreturn1.C: In function `int foo4(int)':
>  > g++.dg/warn/noreturn1.C:50: warning: control reaches end of non-void
> function  > g++.dg/warn/noreturn1.C: In function `void foo6()':
>  > g++.dg/warn/noreturn1.C:60: warning: `noreturn' function does return
>  > g++.dg/warn/noreturn1.C: In function `void foo8()':
>  > g++.dg/warn/noreturn1.C:70: warning: `noreturn' function does return

Yes, this is a bug.

> I don't know how to fix this, but in the mean time ok to install the
> test?

File a report in GNATS.

If you want to check in the testcase that's OK -- but make sure you
XFAIL it.  We're not supposed to be checking in tests that cause new
FAILs.

Really, it's better just to put the test case in GNATS.  The problem
with checking in test cases for things that fail is that we tend to
end up with lots of tests for the same failures -- there's no easy
way to know that there's not already a test for the same problem.

We end up with multiple reports for the same bug in GANTS too -- but
when you go to fix the second one you realize it's already been fixed.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the Gcc-patches mailing list