Bug 111758 - #pragma region/endregion fails between if/else
Summary: #pragma region/endregion fails between if/else
Status: RESOLVED DUPLICATE of bug 63326
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-10 12:08 UTC by Domen Stangar
Modified: 2023-10-10 21:17 UTC (History)
0 users

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 Domen Stangar 2023-10-10 12:08:02 UTC
#include <stdio.h>
int main() {
    #pragma region test
    if(1){}
    #pragma endregion
    else{}
}

gcc 13.x fails with output

<source>: In function 'main':
<source>:7:5: error: 'else' without a previous 'if'
    7 |     else
      |     ^~~~
Compiler returned: 1

while 12.x works fine.
Comment 1 Andrew Pinski 2023-10-10 12:13:47 UTC
Dup of bug 63326.

*** This bug has been marked as a duplicate of bug 63326 ***
Comment 2 Domen Stangar 2023-10-10 12:21:19 UTC
I don't agree. This works fine with 12.x version and bug report is for version 4.9.1.
And this compiles with 4.9.1 version.
Comment 3 Andrew Pinski 2023-10-10 21:17:03 UTC
(In reply to Domen Stangar from comment #2)
> I don't agree. This works fine with 12.x version and bug report is for
> version 4.9.1.
> And this compiles with 4.9.1 version.

yes it might have "worked" in 12.x but these pragma were not recognized until r13-3887-gd3fe767c16e7c528e4fc71c8a68ac14b4573d880 (PR 85487) so you run into the same issue as PR 63326 after that patch.