]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/54694 (internal compiler error: in dwarf2out_frame_debug_expr, at dwarf2o...
authorRichard Henderson <rth@redhat.com>
Thu, 16 Jan 2014 16:33:30 +0000 (08:33 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 16 Jan 2014 16:33:30 +0000 (08:33 -0800)
PR debug/54694

Diagnose frame_pointer_required vs fixed hfp

From-SVN: r206667

gcc/ChangeLog
gcc/ira.c
gcc/reginfo.c
gcc/rtl.h
gcc/testsuite/gcc.target/i386/pr54694.c [new file with mode: 0644]

index 1fd13ea2b012bea28e160efdac8818fe854a764f..4f901d895e416349a54182bf8c361a9d7f44fd44 100644 (file)
@@ -1,3 +1,11 @@
+2014-01-16  Richard Henderson <rth@redhat.com>
+
+       PR debug/54694
+       * reginfo.c (global_regs_decl): Globalize.
+       * rtl.h (global_regs_decl): Declare.
+       * ira.c (do_reload): Diagnose frame_pointer_needed and it
+       reserved via global_regs.
+
 2014-01-16  Marek Polacek  <polacek@redhat.com>
 
        Backport from mainline
index 41a2928d0c9dab8ead0380f4a401845846f0e664..66a8a288800862f0df8bed751dec700e117c10f7 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3788,6 +3788,18 @@ do_reload (void)
   if (need_dce && optimize)
     run_fast_dce ();
 
+  /* Diagnose uses of the hard frame pointer when it is used as a global
+     register.  Often we can get away with letting the user appropriate
+     the frame pointer, but we should let them know when code generation
+     makes that impossible.  */
+  if (global_regs[HARD_FRAME_POINTER_REGNUM] && frame_pointer_needed)
+    {
+      tree decl = global_regs_decl[HARD_FRAME_POINTER_REGNUM];
+      error_at (DECL_SOURCE_LOCATION (current_function_decl),
+                "frame pointer required, but reserved");
+      inform (DECL_SOURCE_LOCATION (decl), "for %qD", decl);
+    }
+
   timevar_pop (TV_IRA);
 }
 \f
index 635312655bcd0d95da19cfd8d86044518f44b09f..d2c4b6e306bbf53e17475f557b32d913bccfd565 100644 (file)
@@ -88,7 +88,7 @@ static const char initial_call_really_used_regs[] = CALL_REALLY_USED_REGISTERS;
 char global_regs[FIRST_PSEUDO_REGISTER];
 
 /* Declaration for the global register. */
-static tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
+tree global_regs_decl[FIRST_PSEUDO_REGISTER];
 
 /* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used
    in dataflow more conveniently.  */
index b1b681be568261899cd910c0e695a3181ac23b8b..fbd7e421afba52be753c8044067b2fb667f8ae80 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2681,6 +2681,8 @@ extern void _fatal_insn (const char *, const_rtx, const char *, int, const char
 #define fatal_insn_not_found(insn) \
        _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
 
+/* reginfo.c */
+extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
 
 
 #endif /* ! GCC_RTL_H */
diff --git a/gcc/testsuite/gcc.target/i386/pr54694.c b/gcc/testsuite/gcc.target/i386/pr54694.c
new file mode 100644 (file)
index 0000000..bcf82c2
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+register void *hfp __asm__("%ebp");    /* { dg-message "note: for" } */
+
+extern void g(void *);
+
+void f(int x)                  /* { dg-error "frame pointer required" } */
+{
+  g(__builtin_alloca(x));
+}