+2003-07-08 Roger Sayle <roger@eyesopen.com>
+
+ PR c/11370
+ * calls.c (emit_call_1): Don't bother popping the arguments off of
+ the stack after a noreturn function call; The adjustment is dead.
+ (expand_call): Likewise.
+
2003-07-08 Geoffrey Keating <geoffk@apple.com>
* expr.c (MOVE_MAX_PIECES): Move from here...
if the context of the call as a whole permits. */
inhibit_defer_pop = old_inhibit_defer_pop;
+ /* Don't bother cleaning up after a noreturn function. */
+ if (ecf_flags & (ECF_NORETURN | ECF_LONGJMP))
+ return;
+
if (n_popped > 0)
{
if (!already_popped)
}
emit_barrier_after (last);
+
+ /* Stack adjustments after a noreturn call are dead code. */
+ stack_pointer_delta = old_stack_allocated;
+ pending_stack_adjust = 0;
}
if (flags & ECF_LONGJMP)
normal_call_insns = insns;
/* Verify that we've deallocated all the stack we used. */
- if (old_stack_allocated !=
- stack_pointer_delta - pending_stack_adjust)
+ if (! (flags & (ECF_NORETURN | ECF_LONGJMP))
+ && old_stack_allocated != stack_pointer_delta
+ - pending_stack_adjust)
abort ();
}
+2003-07-08 Roger Sayle <roger@eyesopen.com>
+
+ PR c/11370
+ * gcc.dg/Wunreachable-6.c: New testcase.
+ * gcc.dg/Wunreachable-7.c: New testcase.
+
2003-07-08 Jakub Jelinek <jakub@redhat.com>
PR c/11420
--- /dev/null
+/* PR c/11370 */
+/* { dg-do compile } */
+/* { dg-options "-Wunreachable-code" } */
+
+int main(int argc, char *argv[])
+{
+ if (argc != 1)
+ exit(1);
+
+ {
+ int ix; /* { dg-bogus "will never be executed" } */
+ ix = printf("hello\n");
+ printf("%d\n", ix);
+ }
+
+ return 0;
+}
+
--- /dev/null
+/* PR c/11370 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunreachable-code" } */
+
+int main(int argc, char *argv[])
+{
+ if (argc != 1)
+ exit(1);
+
+ {
+ int ix; /* { dg-bogus "will never be executed" } */
+ ix = printf("hello\n");
+ printf("%d\n", ix);
+ }
+
+ return 0;
+}
+