This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [new-regalloc-branch] RTL check failure on x86


Dan Nicolaescu <dann@godzilla.ICS.UCI.EDU> writes:

> On i686-pc-linux-gnu (RedHat-6.2)
> 
> configured with:
> 
> ../gcc-CVS/configure  --prefix=/home/dann/GCC-newRA --disable-nls --disable-multilib --enable-languages=c --enable-checking=misc,tree,rtl,gc,gcac
> 
> 
> when bootraping it gives (while building stage1):
> 
> ./xgcc -B./ -B/home/dann/GCC-newRA/i686-pc-linux-gnu/bin/ -isystem /home/dann/GCC-newRA/i686-pc-linux-gnu/include -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -I. -I. -I../../gcc-CVS/gcc -I../../gcc-CVS/gcc/. -I../../gcc-CVS/gcc/config -I../../gcc-CVS/gcc/../include -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-omit-frame-pointer -c ../../gcc-CVS/gcc/crtstuff.c -DCRT_BEGIN -o crtbegin.o
> cc1: warning: changing search order for system directory "include"
> cc1: warning:   as it has already been specified as a system directory
> ../../gcc-CVS/gcc/crtstuff.c: In function `__do_global_dtors_aux':
> ../../gcc-CVS/gcc/crtstuff.c:227: RTL check: expected code `set' or
> `clobber', have `use' in df_insn_refs_record, at df.c:1244
This is because we don't have a way to specify that it can also be a
USE, since we have no checking macros for RTL that allow three
alternatives.
The code is indeed doing the right thing, clobbers and uses have the
 same format, it's just the checking that's wrong.

This patch should fix it.

Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.240.2.6
diff -c -3 -p -w -B -b -r1.240.2.6 rtl.h
*** rtl.h	2001/07/27 18:09:20	1.240.2.6
--- rtl.h	2001/08/02 21:06:37
*************** typedef struct rtvec_def{
*** 275,280 ****
--- 275,287 ----
         rtl_check_failed_code2(_rtx, C1, C2, __FILE__, __LINE__, __FUNCTION__); \
       &_rtx->fld[_n]; }))
  
+ #define RTL_CHECKC3(RTX, N, C1, C2, C3) __extension__			\
+ (*({ rtx _rtx = (RTX); int _n = (N);					\
+      enum rtx_code _code = GET_CODE (_rtx);				\
+      if (_code != C1 && _code != C2 && _code != C3)					\
+        rtl_check_failed_code3(_rtx, C1, C2, C3, __FILE__, __LINE__, __FUNCTION__); \
+      &_rtx->fld[_n]; }))
+ 
  #define RTVEC_ELT(RTVEC, I) __extension__				\
  (*({ rtvec _rtvec = (RTVEC); int _i = (I);				\
       if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec))				\
*************** extern void rtl_check_failed_code1 PARAM
*** 297,302 ****
--- 304,312 ----
  extern void rtl_check_failed_code2 PARAMS ((rtx, enum rtx_code, enum rtx_code,
  					  const char *, int, const char *))
      ATTRIBUTE_NORETURN;
+ extern void rtl_check_failed_code3 PARAMS ((rtx, enum rtx_code, enum rtx_code,
+ 					  enum rtx_code, const char *, int, const char *))
+     ATTRIBUTE_NORETURN;
  extern void rtvec_check_failed_bounds PARAMS ((rtvec, int,
  					     const char *, int, const char *))
      ATTRIBUTE_NORETURN;
*************** extern void rtvec_check_failed_bounds PA
*** 307,312 ****
--- 317,323 ----
  #define RTL_CHECK2(RTX, N, C1, C2)  ((RTX)->fld[N])
  #define RTL_CHECKC1(RTX, N, C)	    ((RTX)->fld[N])
  #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->fld[N])
+ #define RTL_CHECKC3(RTX, N, C1, C2, C3) ((RTX)->fld[N])
  #define RTVEC_ELT(RTVEC, I)	    ((RTVEC)->elem[I])
  
  #endif
*************** extern void rtvec_check_failed_bounds PA
*** 358,363 ****
--- 369,375 ----
  #define XCVECLEN(RTX, N, C)	GET_NUM_ELEM (XCVEC (RTX, N, C))
  
  #define XC2EXP(RTX, N, C1, C2)      (RTL_CHECKC2(RTX, N, C1, C2).rtx)
+ #define XC3EXP(RTX, N, C1, C2, C3)      (RTL_CHECKC3(RTX, N, C1, C2, C3).rtx)
  
  /* ACCESS MACROS for particular fields of insns.  */
  
*************** extern unsigned int subreg_regno 	PARAMS
*** 913,919 ****
  
  /* For a SET rtx, SET_DEST is the place that is set
     and SET_SRC is the value it is set to.  */
! #define SET_DEST(RTX) XC2EXP(RTX, 0, SET, CLOBBER)
  #define SET_SRC(RTX) XCEXP(RTX, 1, SET)
  
  /* For a TRAP_IF rtx, TRAP_CONDITION is an expression.  */
--- 925,931 ----
  
  /* For a SET rtx, SET_DEST is the place that is set
     and SET_SRC is the value it is set to.  */
! #define SET_DEST(RTX) XC3EXP(RTX, 0, SET, CLOBBER, USE)
  #define SET_SRC(RTX) XCEXP(RTX, 1, SET)
  
  /* For a TRAP_IF rtx, TRAP_CONDITION is an expression.  */
Index: rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.c,v
retrieving revision 1.86.2.1
diff -c -3 -p -w -B -b -r1.86.2.1 rtl.c
*** rtl.c	2001/07/17 21:41:19	1.86.2.1
--- rtl.c	2001/08/02 21:06:38
*************** rtl_check_failed_code2 (r, code1, code2,
*** 744,749 ****
--- 744,763 ----
       GET_RTX_NAME (code1), GET_RTX_NAME (code2), GET_RTX_NAME (GET_CODE (r)),
       func, trim_filename (file), line);
  }
+ void
+ rtl_check_failed_code3 (r, code1, code2, code3, file, line, func)
+     rtx r;
+     enum rtx_code code1, code2, code3;
+     const char *file;
+     int line;
+     const char *func;
+ {
+   internal_error
+     ("RTL check: expected code `%s' or `%s' or '%s', have `%s' in %s, at %s:%d",
+      GET_RTX_NAME (code1), GET_RTX_NAME (code2), GET_RTX_NAME (code3), GET_RTX_NAME (GET_CODE (r)),
+      func, trim_filename (file), line);
+ }
+ 
  
  /* XXX Maybe print the vector?  */
  void

> 
> The preprocessed source can be found at: 
> http://www.ics.uci.edu/~dann/crtbegin.i.gz
> 
>         --dan

-- 
"It's a good apartment because they allow pets.  I have a
Shetland pony named Nikkie.  Last summer Nikkie was involved in
a bizarre electrolysis accident.  All her hair was removed
except for her tail.  Now I rent her out to Hare Krishna family
picnics.
"-Steven Wright


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]