From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30702 invoked by alias); 20 Sep 2011 16:15:57 -0000 Received: (qmail 30631 invoked by uid 22791); 20 Sep 2011 16:15:54 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Sep 2011 16:15:29 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 20 Sep 2011 09:15:29 -0700 X-ExtLoop1: 1 Received: from azsmsx601.amr.corp.intel.com ([10.2.121.193]) by AZSMGA002.ch.intel.com with ESMTP; 20 Sep 2011 09:15:29 -0700 Received: from azsmsx502.amr.corp.intel.com ([10.2.121.75]) by azsmsx601.amr.corp.intel.com ([10.2.121.193]) with mapi; Tue, 20 Sep 2011 09:15:29 -0700 From: "Iyer, Balaji V" To: Sandeep Soni , GCC LIST CC: Diego Novillo Date: Tue, 20 Sep 2011 16:15:00 -0000 Subject: RE: [gimplefe] Ran into a internal compiler error Message-ID: <2950715866004049A240A2F9BB410E7315F3B61E33@azsmsx502.amr.corp.intel.com> References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00196.txt.bz2 HI Sandeep, I think what it is saying is that it is requiring an identifier, but you a= re passing in a variable declaration. Please try to do the following and se= e if it works. + return IDENTIFIER_HASH_VALUE (base->decl); } With return IDENTIFIER_HASH_VALUE (DECL_NAME (base->decl)); Thanks, Balaji V. Iyer. -----Original Message----- From: Sandeep Soni [mailto:soni.sandeepb@gmail.com]=20 Sent: Monday, September 19, 2011 11:32 PM To: GCC LIST Cc: Diego Novillo Subject: [gimplefe] Ran into a internal compiler error Hi, I was trying to make a symbol table for all the variable declarations for t= he gimple front end. Following is a patch: Index: parser.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- parser.c (revision 174754) +++ parser.c (working copy) @@ -28,6 +28,7 @@ #include "tree.h" #include "gimple.h" #include "parser.h" +#include "hashtab.h" #include "ggc.h" /* The GIMPLE parser. Note: do not use this variable directly. It is @@ = -807,6 +808,31 @@ } } + +struct gimple_symtab_entry_def +{ + tree decl; +}; + +static hashval_t +gimple_symtab_entry_hash (const void *entry) { + const struct gimple_symtab_entry_def *base =3D + (const struct gimple_symtab_entry_def *)entry; + return IDENTIFIER_HASH_VALUE (base->decl); } + +static int +gimple_symtab_eq_hash (const void *entry1, const void *entry2) { + const struct gimple_symtab_entry_def *p1 =3D + (const struct gimple_symtab_entry_def *)entry1; + const struct gimple_symtab_entry_def *p2 =3D + (const struct gimple_symtab_entry_def *)entry2; + + return (p1->decl =3D=3D p2->decl); +} + /* The Declaration section within a .gimple file can consist of a) Declaration of variables. b) Declaration of functions. @@ -871,10 +897,29 @@ gp_parse_var_decl (gimple_parser *parser) { const gimple_token *next_token; + const gimple_token *name_token; + const char* name; enum tree_code code ; + htab_t gimple_symtab; + void **slot1, **slot2; + struct gimple_symtab_entry_def e; + + gimple_symtab =3D htab_create_ggc (10, gimple_symtab_entry_hash, gimple_symtab_eq_hash, NULL); gl_consume_expected_token (parser->lexer, CPP_LESS); - gl_consume_expected_token (parser->lexer, CPP_NAME); + name_token =3D gl_consume_expected_token (parser->lexer, CPP_NAME);=20=20 + name =3D gl_token_as_text(name_token); e.decl =3D build_decl=20 + (UNKNOWN_LOCATION, VAR_DECL, get_identifier(name), void_type_node); + slot1 =3D htab_find_slot (gimple_symtab ,&e, INSERT); + slot2 =3D htab_find_slot (gimple_symtab, &e, NO_INSERT); if (slot1 =3D= =3D=20 + slot2) + { + printf ("I think this is right\n"); + } + else + { + printf ("Or this is wrong\n"); + } gl_consume_expected_token (parser->lexer, CPP_COMMA); next_token =3D gl_consume_token (parser->lexer); @@ -1391,7 +1436,6 @@ parser_gc_root__ =3D NULL; } - /* Main entry point for the GIMPLE front end. */ void @@ -1402,7 +1446,6 @@ parser_gc_root__ =3D parser =3D gp_init (main_input_filename); if (parser->lexer->filename =3D=3D NULL) return; - gl_lex (parser->lexer); gp_parse (parser); gp_finish (parser); It gives me a internal compiler error saying: gimple1: internal compiler error: tree check: expected identifier_node, hav= e var_decl in gimple_symtab_entry_hash Is there something that I have gotten wrong or something that I had to do b= efore that I missed? -- Cheers Sandy