Hi all,


I'm working on updating GHDL to a newer version of GCC. So far, I've managed to 
get it to compile and run with GCC 4.4.5 producing expected results on my 
(rather limited) testsuite. Moving on to GCC 4.5.0 I've run into problems 
though. When compiling GCC and GHDL with the changes to the code given below, I 
get the following error 

make[4]: Entering directory `/home/kst/source/gcc-4.5.0-obj/gcc/vhdl'
../ghdl1 --std=87 -quiet -o std_standard.s --compile-standard
*no-file*: In function ‘std__standard__string_EQ’:
*no-file*:1:0: internal compiler error: in execute_one_pass, at passes.c:1523
Please submit a full bug report,


I've tracked it to a NULL value in the variable 'cfun' and an assert failing as 
a consequence. So far I've been unable to pin the issue down any further. 


Does anyone have any idea what could be the problem? This is the first time I 
look at GCC code and documentation is a bit scarce so any pointers are 
appreciated.  



Regards,
Kevin Steffensen



--- gcc-4.3.4/gcc/vhdl/ortho-lang.c    2009-10-30 06:00:00.000000000 +0100
+++ gcc-4.5.0/gcc/vhdl/ortho-lang.c    2011-01-25 10:02:47.000000000 +0100
@@ -15,19 +15,20 @@
 #include "opts.h"
 #include "options.h"
 #include "real.h"
-#include "tree-gimple.h"
+#include "gimple.h"
 #include "function.h"
 #include "cgraph.h"
 #include "target.h"
 #include "convert.h"
 #include "tree-pass.h"
 #include "tree-dump.h"
+#include "flags.h"
 
 static tree type_for_size (unsigned int precision, int unsignedp);
 
 const int tree_identifier_size = sizeof (struct tree_identifier);
 
-struct binding_level GTY(())
+struct GTY(()) binding_level 
 {
   /*  The BIND_EXPR node for this binding.  */
   tree bind;
@@ -133,7 +134,7 @@
       tree t;
 
       /* Create an artificial var to save the stack pointer.  */
-      tmp_var = build_decl (VAR_DECL, NULL, ptr_type_node);
+      tmp_var = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL, ptr_type_node);
       DECL_ARTIFICIAL (tmp_var) = true;
       DECL_IGNORED_P (tmp_var) = true;
       TREE_USED (tmp_var) = true;
@@ -141,13 +142,13 @@
 
       /* Create the save stmt.  */
       save_call = build_function_call_expr
-    (implicit_built_in_decls[BUILT_IN_STACK_SAVE], NULL_TREE);
+    (UNKNOWN_LOCATION, implicit_built_in_decls[BUILT_IN_STACK_SAVE], 
NULL_TREE);
       save = build2 (MODIFY_EXPR, ptr_type_node, tmp_var, save_call);
       TREE_SIDE_EFFECTS (save) = true;
 
       /* Create the restore stmt.  */
       restore = build_function_call_expr
-    (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
+    (UNKNOWN_LOCATION, implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
      tree_cons (NULL_TREE, tmp_var, NULL_TREE));
 
       /* Build a try-finally block.
@@ -257,9 +258,9 @@
   set_sizetype (size_type_node);
   build_common_tree_nodes_2 (0);
 
-  n = build_decl (TYPE_DECL, get_identifier ("int"), integer_type_node);
+  n = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier ("int"), 
integer_type_node);
   push_decl (n);
-  n = build_decl (TYPE_DECL, get_identifier ("char"), char_type_node);
+  n = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier ("char"), 
char_type_node);
   push_decl (n);
 
   /* Create alloca builtin.  */
@@ -330,6 +331,10 @@
 {
   if (*pfilename == NULL || strcmp (*pfilename, "-") == 0)
     *pfilename = "*stdin*";
+ 
+  /* Excess precision other than "fast" requires front-end
+     support.  */
+  flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
 
   /* Run the back-end.  */
   return false;
@@ -586,7 +591,7 @@
           const char *library_name,
           tree attrs ATTRIBUTE_UNUSED)
 {
-  tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
+  tree decl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, get_identifier 
(name), type);
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   if (library_name)
@@ -678,55 +683,26 @@
 #undef LANG_HOOKS_GETDECLS
 #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
 
-const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-
-/* Tree code classes.  */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-const enum tree_code_class tree_code_type[] = {
-#include "tree.def"
-  'x'
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
-   operands beyond the fixed part of the node structure.
-   Not used for types or decls.  */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-const unsigned char tree_code_length[] = {
-#include "tree.def"
-  0
-};
-#undef DEFTREECODE
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME,
-const char * const tree_code_name[] = {
-#include "tree.def"
-  "@@dummy"
-};
-#undef DEFTREECODE
+struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
-union lang_tree_node 
-  GTY((desc ("0"),
-       chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)")))
+/* Unsure about this change, GENERIC_NEXT is like TREE_CHAIN but able to 
handle tuples....do we need to handle tuples here?? */
+union   GTY((desc ("0"),
+       chain_next ("(union lang_tree_node *) TREE_CHAIN (&%h.generic)"))) 
lang_tree_node 
 {
   union tree_node GTY ((tag ("0"))) generic;
 };
 
-struct lang_decl GTY(())
+struct GTY(()) lang_decl 
 {
   char dummy;
 };
 
-struct lang_type GTY (())
+struct GTY(()) lang_type 
 {
   char dummy;
 };
 
-struct language_function GTY (())
+struct GTY(()) language_function 
 {
   char dummy;
 };
@@ -1075,7 +1051,7 @@
 {
   tree res;
 
-  res = build_decl (FIELD_DECL, ident, etype);
+  res = build_decl (UNKNOWN_LOCATION, FIELD_DECL, ident, etype);
   DECL_CONTEXT (res) = list->res;
   chain_append (&list->chain, res);
   *el = res;
@@ -1162,7 +1138,7 @@
       res = make_node (POINTER_TYPE);
       TREE_TYPE (res) = NULL_TREE;
       /* Seems necessary.  */
-      TYPE_MODE (res) = Pmode;
+      SET_TYPE_MODE (res, Pmode);
       layout_type (res);
       return res;
     }
@@ -1574,7 +1550,7 @@
   tree decl;
 
   TYPE_NAME (atype) = ident;
-  decl = build_decl (TYPE_DECL, ident, atype);
+  decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, ident, atype);
   TYPE_STUB_DECL (atype) = decl;
   push_decl (decl);
   /*
@@ -1623,7 +1599,7 @@
 {
   tree cst;
 
-  cst = build_decl (VAR_DECL, ident, atype);
+  cst = build_decl (UNKNOWN_LOCATION, VAR_DECL, ident, atype);
   set_storage (cst, storage);
   TREE_READONLY (cst) = 1;
   push_decl (cst);
@@ -1663,7 +1639,7 @@
 {
   tree var;
 
-  var = build_decl (VAR_DECL, ident, atype);
+  var = build_decl (UNKNOWN_LOCATION, VAR_DECL, ident, atype);
   if (current_function_decl != NULL_TREE)
     {    
       /*  Local variable. */
@@ -1726,7 +1702,7 @@
 {
   tree r;
 
-  r = build_decl (PARM_DECL, ident, atype);
+  r = build_decl (UNKNOWN_LOCATION, PARM_DECL, ident, atype);
   /* DECL_CONTEXT (Res, Xxx); */
 
   /*  Do type conversion: convert boolean and enums to int  */
@@ -1762,7 +1738,7 @@
      is known not be have variables arguments.  */
   ortho_list_append (&interfaces->param_list, void_type_node);
 
-  decl = build_decl (FUNCTION_DECL, interfaces->ident,
+  decl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, interfaces->ident,
              build_function_type (interfaces->rtype,
                       interfaces->param_list.first));
   DECL_SOURCE_LOCATION (decl) = input_location;
@@ -1784,7 +1760,7 @@
 
   /*  Declare the result.
       FIXME: should be moved in start_function_body. */
-  result = build_decl (RESULT_DECL, NULL_TREE, interfaces->rtype);
+  result = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, 
interfaces->rtype);
   DECL_RESULT (decl) = result;
   DECL_CONTEXT (result) = decl;
 
@@ -2030,7 +2006,7 @@
 {
   tree res;
 
-  res = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
+  res = build_decl (UNKNOWN_LOCATION, LABEL_DECL, NULL_TREE, void_type_node);
   DECL_CONTEXT (res) = current_function_decl;
   DECL_ARTIFICIAL (res) = 1;
   return res;
@@ -2126,7 +2102,7 @@
   tree stmt;
   
   stmt = build3 (CASE_LABEL_EXPR, void_type_node,
-         expr, NULL_TREE, create_artificial_label ());
+         expr, NULL_TREE, create_artificial_label (UNKNOWN_LOCATION));
   append_stmt (stmt);
 }
 
@@ -2136,7 +2112,7 @@
   tree stmt;
 
   stmt = build3 (CASE_LABEL_EXPR, void_type_node,
-         low, high, create_artificial_label ());
+         low, high, create_artificial_label (UNKNOWN_LOCATION));
   append_stmt (stmt);
 }
 
@@ -2146,7 +2122,7 @@
   tree stmt;
 
   stmt = build3 (CASE_LABEL_EXPR, void_type_node,
-         NULL_TREE, NULL_TREE, create_artificial_label ());
+         NULL_TREE, NULL_TREE, create_artificial_label (UNKNOWN_LOCATION));
   append_stmt (stmt);
 }
 
--- gcc-4.3.4/gcc/vhdl/Make-lang.in    2011-01-05 13:24:05.000000000 +0100
+++ gcc-4.5.0/gcc/vhdl/Make-lang.in    2011-01-26 11:41:34.000000000 +0100
@@ -132,7 +132,7 @@
      -cargs $(CFLAGS) $(GHDL_ADAFLAGS)
     $(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \
      -bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \
-     -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS)
+     -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS) $(ZLIB) $(PLUGINLIBS)
 
 # The driver for ghdl.
 ghdl$(exeext): force



                                          
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to