This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Fix TLS related ICE


On Tue, Jul 30, 2002 at 02:12:27PM -0400, Jakub Jelinek wrote:
> If memory_address_p was tested unconditionally there, I'm afraid it would
> cause -fforce-addr by default on most arches (where a SYMBOL_REF
> is not valid memory address).

Hum.  I wonder if that would be a bad thing?

Anyway, I still don't like testing DECL_THREAD_LOCAL here.  How
about something like this instead?


r~


	* calls.c: Include recog.h and insn-config.h.
	(precompute_register_parameters): Force arguments to be
	general_operand.
	* Makefile.in (calls.o): Update.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.919
diff -c -p -d -r1.919 Makefile.in
*** Makefile.in	29 Jul 2002 19:31:23 -0000	1.919
--- Makefile.in	1 Aug 2002 20:52:58 -0000
*************** builtins.o : builtins.c $(CONFIG_H) $(SY
*** 1429,1435 ****
     $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
     except.h $(TM_P_H) $(PREDICT_H) libfuncs.h real.h
  calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
!    $(EXPR_H) langhooks.h \
     libfuncs.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) $(TM_P_H)
  expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h  \
     insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) real.h \
--- 1429,1435 ----
     $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
     except.h $(TM_P_H) $(PREDICT_H) libfuncs.h real.h
  calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
!    $(EXPR_H) langhooks.h $(RECOG_H) insn-config.h \
     libfuncs.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) $(TM_P_H)
  expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h  \
     insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) real.h \
Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.230
diff -c -p -d -r1.230 calls.c
*** calls.c	23 Jul 2002 11:18:10 -0000	1.230
--- calls.c	1 Aug 2002 20:52:58 -0000
*************** Software Foundation, 59 Temple Place - S
*** 30,35 ****
--- 30,37 ----
  #include "regs.h"
  #include "toplev.h"
  #include "output.h"
+ #include "insn-config.h"
+ #include "recog.h"
  #include "tm_p.h"
  #include "timevar.h"
  #include "sbitmap.h"
*************** precompute_register_parameters (num_actu
*** 860,865 ****
--- 862,869 ----
    for (i = 0; i < num_actuals; i++)
      if (args[i].reg != 0 && ! args[i].pass_on_stack)
        {
+         enum machine_mode tmode = TYPE_MODE (TREE_TYPE (args[i].tree_value));
+ 
  	*reg_parm_seen = 1;
  
  	if (args[i].value == 0)
*************** precompute_register_parameters (num_actu
*** 867,872 ****
--- 871,883 ----
  	    push_temp_slots ();
  	    args[i].value = expand_expr (args[i].tree_value, NULL_RTX,
  					 VOIDmode, 0);
+ 
+ 	    /* Make sure that the value computed is legitimate.  In
+ 	       particular, legitimizing a TLS SYMBOL_REF may involve
+ 	       a function call.  */
+ 	    if (! general_operand (args[i].value, tmode))
+ 	      args[i].value = force_reg (tmode, args[i].value);
+ 
  	    preserve_temp_slots (args[i].value);
  	    pop_temp_slots ();
  
*************** precompute_register_parameters (num_actu
*** 878,888 ****
  	/* If we are to promote the function arg to a wider mode,
  	   do it now.  */
  
! 	if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value)))
! 	  args[i].value
! 	    = convert_modes (args[i].mode,
! 			     TYPE_MODE (TREE_TYPE (args[i].tree_value)),
! 			     args[i].value, args[i].unsignedp);
  
  	/* If the value is expensive, and we are inside an appropriately
  	   short loop, put the value into a pseudo and then put the pseudo
--- 889,897 ----
  	/* If we are to promote the function arg to a wider mode,
  	   do it now.  */
  
! 	if (args[i].mode != tmode)
! 	  args[i].value = convert_modes (args[i].mode, tmode,
! 					 args[i].value, args[i].unsignedp);
  
  	/* If the value is expensive, and we are inside an appropriately
  	   short loop, put the value into a pseudo and then put the pseudo


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