public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115434] New: Post contracts are ignored on functions with no return statement.
@ 2024-06-11 14:23 iains at gcc dot gnu.org
  2024-06-11 14:24 ` [Bug c++/115434] " iains at gcc dot gnu.org
  2024-06-23 20:48 ` iains at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: iains at gcc dot gnu.org @ 2024-06-11 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115434

            Bug ID: 115434
           Summary: Post contracts are ignored on functions with no return
                    statement.
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

This applies to void functions and coroutines (which usually have a return
object but do not have a return statement).

e.g:
void foo (const int b) pre ( b == 9 )  // contract checked
{}
int main()
{
   foo(3);
}

void foo (const int b) post ( b == 9 )  // contract not checked
{}
int main()
{
   foo(3);
}

int foo (const int b) post ( b == 9 )  // contract checked
{
  return 1;
}
int main()
{
   foo(3);
}

======

I was expecting the original function body to be wrapped in a try/finally block
with the post function as the cleanup.  Same back to 13.3 so it does not appear
to be a regression.

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

* [Bug c++/115434] Post contracts are ignored on functions with no return statement.
  2024-06-11 14:23 [Bug c++/115434] New: Post contracts are ignored on functions with no return statement iains at gcc dot gnu.org
@ 2024-06-11 14:24 ` iains at gcc dot gnu.org
  2024-06-23 20:48 ` iains at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: iains at gcc dot gnu.org @ 2024-06-11 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115434

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
note that the example uses the new syntax, but the issue applies equally to the
attribute syntax in trunk.

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

* [Bug c++/115434] Post contracts are ignored on functions with no return statement.
  2024-06-11 14:23 [Bug c++/115434] New: Post contracts are ignored on functions with no return statement iains at gcc dot gnu.org
  2024-06-11 14:24 ` [Bug c++/115434] " iains at gcc dot gnu.org
@ 2024-06-23 20:48 ` iains at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: iains at gcc dot gnu.org @ 2024-06-23 20:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115434

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2024-June/65
                   |                            |4848.html
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-23
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org

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

end of thread, other threads:[~2024-06-23 20:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11 14:23 [Bug c++/115434] New: Post contracts are ignored on functions with no return statement iains at gcc dot gnu.org
2024-06-11 14:24 ` [Bug c++/115434] " iains at gcc dot gnu.org
2024-06-23 20:48 ` iains at gcc dot gnu.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).