NinaRanns / gcc

GNU General Public License v2.0
0 stars 0 forks source link

[trunk] ICE in invalid code #17

Closed NinaRanns closed 1 week ago

NinaRanns commented 2 weeks ago

https://godbolt.org/z/xh8q3cWG8

#include <iostream>
inline int f(int& i)
{
   i++;
}
int main()
{
   int i = 3;
   contract_assert(i > 2)
   f(i);
   std::cout << i;
}
<source>: In function 'int f(int&)':
<source>:5:1: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | }
      | ^
<source>: In function 'int main()':
<source>:10:8: internal compiler error: in cp_parser_statement, at cp/parser.cc:13161
   10 |    f(i);
      |        ^
0x2805185 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t)
    ???:0
0x2818865 internal_error(char const*, ...)
    ???:0
0xa87ede fancy_abort(char const*, int, char const*)
    ???:0
0xc97eca c_parse_file()
    ???:0
0xdef269 c_common_parse_file()
    ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
NinaRanns commented 1 week ago

reproducible on trunk https://godbolt.org/z/51TnzsfGE

NinaRanns commented 1 week ago

fixed in natural syntax branch wtih 3da51afe46c5da897ab8495af0bf80dcb737e138 tracked for trunk with https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117579