middle-end/118325 - nonlocal goto lowering
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
fail
|
Patch failed to apply
|
Commit Message
When nonlocal goto lowering creates an artificial label it fails
to adjust its context.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress
(I doubt good test coverage is present for non-local gotos)
OK when testing succeeds?
Thanks,
Richard.
PR middle-end/118325
* tree-nested.cc (convert_nl_goto_reference): Assign proper
context to generated artificial label.
* gcc.dg/pr118325.c: New testcase.
---
gcc/testsuite/gcc.dg/pr118325.c | 16 ++++++++++++++++
gcc/tree-nested.cc | 1 +
2 files changed, 17 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/pr118325.c
new file mode 100644
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu17 -fchecking" } */
+
+void f(void*);
+
+void z()
+{
+ void g()
+ {
+ __label__ out;
+ int h(void) { goto out; }
+ f(h);
+ out:;
+ }
+ f(g);
+}
@@ -2694,6 +2694,7 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p,
{
new_label = create_artificial_label (UNKNOWN_LOCATION);
DECL_NONLOCAL (new_label) = 1;
+ DECL_CONTEXT (new_label) = target_context;
*slot = new_label;
}
else