]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[D] Fix failing EH execution test on i386.
authoribuclaw <ibuclaw@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Jan 2019 20:40:21 +0000 (20:40 +0000)
committeribuclaw <ibuclaw@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Jan 2019 20:40:21 +0000 (20:40 +0000)
Turn off partitioning unless it was explicitly requested, as it doesn't
work with D exception chaining, where personality routines use LSDA to
determine whether two thrown exceptions are in the same context.

The following distills what was failing in the D testsuite.
```
try {
  try {
    fn();  // throws "1"
  }
  finally {
    throw new Exception("2");
  }
}
catch (Exception e) {
  assert(e.msg == "1");
  assert(e.next.msg == "2");
}
```

gcc/d/ChangeLog:

PR d/87824
* d-lang.cc (d_post_options): Disable implicit
-forder-blocks-and-partition.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267985 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/d/ChangeLog
gcc/d/d-lang.cc

index 441fed8ddb171a41125e5cbb87df73032306c48d..fa4ba35bf6bcc1444e81c539a3e26459af5125a4 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-16  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+       PR d/87824
+       * d-lang.cc (d_post_options): Disable implicit
+       -forder-blocks-and-partition.
+
 2019-01-16  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        * d-codegen.cc (build_typeof_null_value): New function.
index 109bf4bf1393cf0d5094e50bddb6bbe91469ba43..b53e56e65a27d706b86ef26f948a7a5cbb83d7bb 100644 (file)
@@ -725,6 +725,12 @@ d_post_options (const char ** fn)
        global.params.useSwitchError = false;
     }
 
+  /* Turn off partitioning unless it was explicitly requested, as it doesn't
+     work with D exception chaining, where EH handler uses LSDA to determine
+     whether two thrown exception are in the same context.  */
+  if (!global_options_set.x_flag_reorder_blocks_and_partition)
+    global_options.x_flag_reorder_blocks_and_partition = 0;
+
   /* Error about use of deprecated features.  */
   if (global.params.useDeprecated == DIAGNOSTICinform
       && global.params.warnings == DIAGNOSTICerror)