public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Ada broken on i686-linux
@ 2004-09-09 10:28 Arnaud Charlet
  2004-09-09 10:41 ` Nathan Sidwell
  0 siblings, 1 reply; 14+ messages in thread
From: Arnaud Charlet @ 2004-09-09 10:28 UTC (permalink / raw)
  To: gcc

Bootstrapping with default options or -O0 yields:

stage1/xgcc -Bstage1/ -B/home/charlet/cvs/gcc-obj/install/i686-pc-linux-gnu/bin/ -c -g -O0      -gnatpg -gnata -g -O1 -fno-inline \
>  -I- -I. -Iada -I../../gcc-head/gcc/ada ../../gcc-head/gcc/ada/a-except.adb -o ada/a-except.o
+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
| in peel_address, at tree-ssa-loop-ivopts.c:2554                          |
| Error detected at a-exexda.adb:312:8                                     |
[...]
+==========================================================================+

When forcing compilation of a-except.adb with -O0:

stage1/xgcc -Bstage1/ -B/home/charlet/cvs/gcc-obj/install/i686-pc-linux-gnu/bin/ -c -g -O0      -gnatpg -gnata -g -O0 -fno-inline  -I- -I. -Iada -I../../gcc-head/gcc/ada ../../gcc-head/gcc/ada/a-except.adb -o ada/a-except.o
+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
| in create_tmp_var_for, at tree-nested.c:138                              |
| Error detected at a-exextr.adb:148:8                                     |
[...]
+==========================================================================+

Arno

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 10:28 Ada broken on i686-linux Arnaud Charlet
@ 2004-09-09 10:41 ` Nathan Sidwell
  2004-09-09 10:47   ` Arnaud Charlet
  0 siblings, 1 reply; 14+ messages in thread
From: Nathan Sidwell @ 2004-09-09 10:41 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: gcc

Arnaud Charlet wrote:
> Bootstrapping with default options or -O0 yields:
> 
> stage1/xgcc -Bstage1/ -B/home/charlet/cvs/gcc-obj/install/i686-pc-linux-gnu/bin/ -c -g -O0      -gnatpg -gnata -g -O1 -fno-inline \
> 
>> -I- -I. -Iada -I../../gcc-head/gcc/ada ../../gcc-head/gcc/ada/a-except.adb -o ada/a-except.o
> 
> +===========================GNAT BUG DETECTED==============================+
> | 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
> | in peel_address, at tree-ssa-loop-ivopts.c:2554                          |
> | Error detected at a-exexda.adb:312:8                                     |
> [...]
> +==========================================================================+
> 
> When forcing compilation of a-except.adb with -O0:
> 
> stage1/xgcc -Bstage1/ -B/home/charlet/cvs/gcc-obj/install/i686-pc-linux-gnu/bin/ -c -g -O0      -gnatpg -gnata -g -O0 -fno-inline  -I- -I. -Iada -I../../gcc-head/gcc/ada ../../gcc-head/gcc/ada/a-except.adb -o ada/a-except.o
> +===========================GNAT BUG DETECTED==============================+
> | 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
> | in create_tmp_var_for, at tree-nested.c:138                              |
> | Error detected at a-exextr.adb:148:8                                     |
> [...]
> +==========================================================================+

sorry, that's me. I've just committed the fix.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 10:41 ` Nathan Sidwell
@ 2004-09-09 10:47   ` Arnaud Charlet
  2004-09-09 16:14     ` Arnaud Charlet
  0 siblings, 1 reply; 14+ messages in thread
From: Arnaud Charlet @ 2004-09-09 10:47 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: Arnaud Charlet, gcc

> sorry, that's me. I've just committed the fix.

Thanks a lot. I've restarted a bootstrap.

Arno

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 10:47   ` Arnaud Charlet
@ 2004-09-09 16:14     ` Arnaud Charlet
  2004-09-09 17:04       ` Arnaud Charlet
  0 siblings, 1 reply; 14+ messages in thread
From: Arnaud Charlet @ 2004-09-09 16:14 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: Nathan Sidwell, gcc

Thanks to the tree-ssa-loop-ivopts.c change, I am now getting a little bit
further:

<<
stage1/xgcc -Bstage1/ -B/home/charlet/cvs/gcc-obj/install/i686-pc-linux-gnu/bin/ -c -g -O2      -gnatpg -gnata -I- -I. -Iada -I../../gcc-head/gcc/ada ../../gcc-head/gcc/ada/g-os_lib.adb -o ada/g-os_lib.o
../../gcc-head/gcc/ada/g-os_lib.adb: In function `GNAT.OS_LIB.TO_PATH_STRING_ACCESS':
../../gcc-head/gcc/ada/g-os_lib.adb:2224: error: Definition in block 1 does not dominate use in block 8
for SSA_NAME: T.2990<D5646>_4
in statement:
ivtmp.3333<D6218>_59 = &(*return_val$P_ARRAY<D6202>_31)[2]{lb: T.2990<D5646>_4 sz: 1};

+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) verify_ssa failed.     |
| Error detected at g-os_lib.adb:2279:1                                    |
+==========================================================================+
>>

Any idea ?

This can be worked around compiling with -O0, so I'll try a bootstrap with
everything built at -O0 to see whether I can get at least a successful build
and commit my pending changes.

Arno

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 16:14     ` Arnaud Charlet
@ 2004-09-09 17:04       ` Arnaud Charlet
  2004-09-09 17:24         ` Jan Hubicka
  0 siblings, 1 reply; 14+ messages in thread
From: Arnaud Charlet @ 2004-09-09 17:04 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: Nathan Sidwell, gcc

> This can be worked around compiling with -O0, so I'll try a bootstrap with
> everything built at -O0 to see whether I can get at least a successful build
> and commit my pending changes.

Well, I am now hitting the crash already mentioned by Richard and Laurent
on x86_64:

<<
../../xgcc -B../../ -c -g -O0 -fPIC      -W -Wall -gnatpg  a-ncelfu.ads -o a-ncelfu.o
+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
| in optimize_mode_switching, at lcm.c:1225                                |
| Error detected at a-ngelfu.adb:172:16 [a-ngcefu.adb:38:4 [a-ncelfu.ads:19:1]]|>>

Arno

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 17:04       ` Arnaud Charlet
@ 2004-09-09 17:24         ` Jan Hubicka
  2004-09-09 18:41           ` Richard Henderson
  2004-09-09 21:49           ` Ada broken on i686-linux (some progress) Laurent GUERBY
  0 siblings, 2 replies; 14+ messages in thread
From: Jan Hubicka @ 2004-09-09 17:24 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: Nathan Sidwell, gcc, uros

> > This can be worked around compiling with -O0, so I'll try a bootstrap with
> > everything built at -O0 to see whether I can get at least a successful build
> > and commit my pending changes.
> 
> Well, I am now hitting the crash already mentioned by Richard and Laurent
> on x86_64:
> 
> <<
> ../../xgcc -B../../ -c -g -O0 -fPIC      -W -Wall -gnatpg  a-ncelfu.ads -o a-ncelfu.o
> +===========================GNAT BUG DETECTED==============================+
> | 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
> | in optimize_mode_switching, at lcm.c:1225                                |
> | Error detected at a-ngelfu.adb:172:16 [a-ngcefu.adb:38:4 [a-ncelfu.ads:19:1]]|>>

This should be fixed by this patch (this problem is also reproduced by
i686 build).  As discussed with Uros, the current implementation is not
perfect as the mode switching generates unnecesary initializations of
the varioius control words and then it generates too many loads of
control word from them but still it is better than old implementation,
so I would commit it before we get into the more proper sollution.

I think we might get around the first problem by using separate entities
for each mode we want, but still it will generate unnecesary loads of
the global control word that might be avoided by tricking it to be
special entity 0.  The second problem might be solved either by XFmode
spilling or post-reload optimize_mode_switching pass inserting the
control word loads.

Bot since it is somewhat involved, I've bootstrapped/regtested the
attached patch i686-pc-gnu-linux, OK?

double sqrt(double);

template <typename T> class arr
  {
  private:
    long s;
    T *d;

  public:
    arr() : s(0), d(0) {}
    ~arr() { delete[] d; }

    void alloc (long sz);
    const T &operator[] (long n) const {return d[n];}
  };

void blah ()
  {
  arr<int> index;
  index.alloc(10);
  for (int i=0; i<10; ++i)
    {
    int l = int(sqrt(index[0]));
    if (l<0) throw 2;
    }
  }

Honza

Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.400
diff -c -3 -p -r1.400 i386.h
*** config/i386/i386.h	4 Sep 2004 07:55:07 -0000	1.400
--- config/i386/i386.h	9 Sep 2004 08:18:02 -0000
*************** extern rtx ix86_compare_op1;	/* operand 
*** 2966,2972 ****
    (GET_CODE (I) == CALL_INSN						\
     || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
  				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
!    ? I387_CW_ANY 							\
     : recog_memoized (I) < 0						\
     ? I387_CW_ANY 							\
     : get_attr_i387_cw (I))
--- 2966,2972 ----
    (GET_CODE (I) == CALL_INSN						\
     || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
  				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
!    ? I387_CW_UNINITIALIZED						\
     : recog_memoized (I) < 0						\
     ? I387_CW_ANY 							\
     : get_attr_i387_cw (I))
*************** extern rtx ix86_compare_op1;	/* operand 
*** 2981,2987 ****
     are to be inserted.  */
  
  #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
!   ((MODE) != I387_CW_ANY						\
     ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
  				  assign_386_stack_local (HImode, 2),   \
  				  MODE), 0				\
--- 2981,2987 ----
     are to be inserted.  */
  
  #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
!   ((MODE) != I387_CW_ANY && (MODE) != I387_CW_UNINITIALIZED		\
     ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
  				  assign_386_stack_local (HImode, 2),   \
  				  MODE), 0				\
Index: config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.558
diff -c -3 -p -r1.558 i386.md
*** config/i386/i386.md	8 Sep 2004 05:08:26 -0000	1.558
--- config/i386/i386.md	9 Sep 2004 08:18:03 -0000
***************
*** 431,437 ****
  
  ;; Defines rounding mode of an FP operation.
  
! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,any"
    (const_string "any"))
  
  ;; Describe a user's asm statement.
--- 431,437 ----
  
  ;; Defines rounding mode of an FP operation.
  
! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,uninitialized,any"
    (const_string "any"))
  
  ;; Describe a user's asm statement.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 17:24         ` Jan Hubicka
@ 2004-09-09 18:41           ` Richard Henderson
  2004-09-10  9:40             ` Jan Hubicka
  2004-09-10 10:10             ` Jan Hubicka
  2004-09-09 21:49           ` Ada broken on i686-linux (some progress) Laurent GUERBY
  1 sibling, 2 replies; 14+ messages in thread
From: Richard Henderson @ 2004-09-09 18:41 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Arnaud Charlet, Nathan Sidwell, gcc, uros

On Thu, Sep 09, 2004 at 05:29:03PM +0200, Jan Hubicka wrote:
> This should be fixed by this patch (this problem is also reproduced by
> i686 build).

I don't understand how this patch is supposed to work.  I see nothing
that distinguishes between I387_CW_UNINITIALIZED and I387_CW_ANY.


r~

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-09 17:24         ` Jan Hubicka
  2004-09-09 18:41           ` Richard Henderson
@ 2004-09-09 21:49           ` Laurent GUERBY
  2004-09-10  9:38             ` Jan Hubicka
  1 sibling, 1 reply; 14+ messages in thread
From: Laurent GUERBY @ 2004-09-09 21:49 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Arnaud Charlet, Nathan Sidwell, gcc, uros

With mainline plus your patch, on x86_64 it gets past the a-ngelfu.adb
failure but it ICE later in the RTS build:

../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-exctra.adb -o g-exctra.o
+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
| in var_ann, at tree-flow-inline.h:34                                     |
| Error detected at g-exctra.adb:127:1                                     |

On x86, it fails mid stage2:

stage1/xgcc -Bstage1/ -B/home/guerby/work/gcc/install/install-20040909T225159/i686-pc-linux-gnu/bin/ -c -g -O2      -gnatpg -gnata -I- -I. -Iada -I/home/guerby/work/gcc/version-head/gcc/ada /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb -o ada/g-os_lib.o
/home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb: In function `GNAT.OS_LIB.TO_PATH_STRING_ACCESS':
/home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb:2224: error: Definition in block 1 does not dominate use in block 8
for SSA_NAME: T.2976<D5632>_4
in statement:
ivtmp.3319<D6204>_59 = &(*return_val$P_ARRAY<D6188>_31)[2]{lb: T.2976<D5632>_4 sz: 1};

+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) verify_ssa failed.     |
| Error detected at g-os_lib.adb:2279:1                                    |

Laurent

On Thu, 2004-09-09 at 17:29, Jan Hubicka wrote:
> > > This can be worked around compiling with -O0, so I'll try a bootstrap with
> > > everything built at -O0 to see whether I can get at least a successful build
> > > and commit my pending changes.
> > 
> > Well, I am now hitting the crash already mentioned by Richard and Laurent
> > on x86_64:
> > 
> > <<
> > ../../xgcc -B../../ -c -g -O0 -fPIC      -W -Wall -gnatpg  a-ncelfu.ads -o a-ncelfu.o
> > +===========================GNAT BUG DETECTED==============================+
> > | 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
> > | in optimize_mode_switching, at lcm.c:1225                                |
> > | Error detected at a-ngelfu.adb:172:16 [a-ngcefu.adb:38:4 [a-ncelfu.ads:19:1]]|>>
> 
> This should be fixed by this patch (this problem is also reproduced by
> i686 build).  As discussed with Uros, the current implementation is not
> perfect as the mode switching generates unnecesary initializations of
> the varioius control words and then it generates too many loads of
> control word from them but still it is better than old implementation,
> so I would commit it before we get into the more proper sollution.
> 
> I think we might get around the first problem by using separate entities
> for each mode we want, but still it will generate unnecesary loads of
> the global control word that might be avoided by tricking it to be
> special entity 0.  The second problem might be solved either by XFmode
> spilling or post-reload optimize_mode_switching pass inserting the
> control word loads.
> 
> Bot since it is somewhat involved, I've bootstrapped/regtested the
> attached patch i686-pc-gnu-linux, OK?
> 
> double sqrt(double);
> 
> template <typename T> class arr
>   {
>   private:
>     long s;
>     T *d;
> 
>   public:
>     arr() : s(0), d(0) {}
>     ~arr() { delete[] d; }
> 
>     void alloc (long sz);
>     const T &operator[] (long n) const {return d[n];}
>   };
> 
> void blah ()
>   {
>   arr<int> index;
>   index.alloc(10);
>   for (int i=0; i<10; ++i)
>     {
>     int l = int(sqrt(index[0]));
>     if (l<0) throw 2;
>     }
>   }
> 
> Honza
> 
> Index: config/i386/i386.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
> retrieving revision 1.400
> diff -c -3 -p -r1.400 i386.h
> *** config/i386/i386.h	4 Sep 2004 07:55:07 -0000	1.400
> --- config/i386/i386.h	9 Sep 2004 08:18:02 -0000
> *************** extern rtx ix86_compare_op1;	/* operand 
> *** 2966,2972 ****
>     (GET_CODE (I) == CALL_INSN						\
>      || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
>   				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
> !    ? I387_CW_ANY 							\
>      : recog_memoized (I) < 0						\
>      ? I387_CW_ANY 							\
>      : get_attr_i387_cw (I))
> --- 2966,2972 ----
>     (GET_CODE (I) == CALL_INSN						\
>      || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
>   				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
> !    ? I387_CW_UNINITIALIZED						\
>      : recog_memoized (I) < 0						\
>      ? I387_CW_ANY 							\
>      : get_attr_i387_cw (I))
> *************** extern rtx ix86_compare_op1;	/* operand 
> *** 2981,2987 ****
>      are to be inserted.  */
>   
>   #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
> !   ((MODE) != I387_CW_ANY						\
>      ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
>   				  assign_386_stack_local (HImode, 2),   \
>   				  MODE), 0				\
> --- 2981,2987 ----
>      are to be inserted.  */
>   
>   #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
> !   ((MODE) != I387_CW_ANY && (MODE) != I387_CW_UNINITIALIZED		\
>      ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
>   				  assign_386_stack_local (HImode, 2),   \
>   				  MODE), 0				\
> Index: config/i386/i386.md
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
> retrieving revision 1.558
> diff -c -3 -p -r1.558 i386.md
> *** config/i386/i386.md	8 Sep 2004 05:08:26 -0000	1.558
> --- config/i386/i386.md	9 Sep 2004 08:18:03 -0000
> ***************
> *** 431,437 ****
>   
>   ;; Defines rounding mode of an FP operation.
>   
> ! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,any"
>     (const_string "any"))
>   
>   ;; Describe a user's asm statement.
> --- 431,437 ----
>   
>   ;; Defines rounding mode of an FP operation.
>   
> ! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,uninitialized,any"
>     (const_string "any"))
>   
>   ;; Describe a user's asm statement.
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-09 21:49           ` Ada broken on i686-linux (some progress) Laurent GUERBY
@ 2004-09-10  9:38             ` Jan Hubicka
  0 siblings, 0 replies; 14+ messages in thread
From: Jan Hubicka @ 2004-09-10  9:38 UTC (permalink / raw)
  To: Laurent GUERBY; +Cc: Jan Hubicka, Arnaud Charlet, Nathan Sidwell, gcc, uros

> With mainline plus your patch, on x86_64 it gets past the a-ngelfu.adb
> failure but it ICE later in the RTS build:
> 
> ../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-exctra.adb -o g-exctra.o
> +===========================GNAT BUG DETECTED==============================+
> | 3.5.0 20040909 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
> | in var_ann, at tree-flow-inline.h:34                                     |
> | Error detected at g-exctra.adb:127:1                                     |
> 
> On x86, it fails mid stage2:
> 
> stage1/xgcc -Bstage1/ -B/home/guerby/work/gcc/install/install-20040909T225159/i686-pc-linux-gnu/bin/ -c -g -O2      -gnatpg -gnata -I- -I. -Iada -I/home/guerby/work/gcc/version-head/gcc/ada /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb -o ada/g-os_lib.o
> /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb: In function `GNAT.OS_LIB.TO_PATH_STRING_ACCESS':
> /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb:2224: error: Definition in block 1 does not dominate use in block 8
> for SSA_NAME: T.2976<D5632>_4
> in statement:
> ivtmp.3319<D6204>_59 = &(*return_val$P_ARRAY<D6188>_31)[2]{lb: T.2976<D5632>_4 sz: 1};

It would be usefull to know the backtraces at least here.  The second
problem looks like yet another tree node sharing problem, so in the case
the failure is within tree-ssa-loop-ivopts, I will try to add more of
unsave_exprs to uses that might result in sharing and lets see if it fix
it.

I dunno what is going wrong in the first case just from the failure
reported.

What is the current situation of ada aware gdb?  I used to have one but
it no longer works on 3.5 GCC produced dwarf and the default in my
instalation just die horribly seeing ada.

Honza

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 18:41           ` Richard Henderson
@ 2004-09-10  9:40             ` Jan Hubicka
  2004-09-10 19:07               ` Richard Henderson
  2004-09-10 10:10             ` Jan Hubicka
  1 sibling, 1 reply; 14+ messages in thread
From: Jan Hubicka @ 2004-09-10  9:40 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, Arnaud Charlet, Nathan Sidwell,
	gcc, uros

> On Thu, Sep 09, 2004 at 05:29:03PM +0200, Jan Hubicka wrote:
> > This should be fixed by this patch (this problem is also reproduced by
> > i686 build).
> 
> I don't understand how this patch is supposed to work.  I see nothing
> that distinguishes between I387_CW_UNINITIALIZED and I387_CW_ANY.

Actually it took me a while too as this is poorly documented in tm.texi,
but my recollection is that the last mode in list is special by having
maning "no mode".  That means that instruction requiring I387_CW_ANY.
won't force any switching, while instruction  I387_CW_UNINITIALIZED will
force mode switch to I387_CW_UNINITIALIZED that will result in noop and
switch back to something !I387_CW_ANY (if used in the proram) afterwards
that will force re-computation of the memory copies of the control word.

See code concerning "no_mode" in lcm.c

At very minimum we should update MODE_NEEDED saying "the mode number
specified by NUM_MODES_FOR_MODE_SWITCHING has special semantic so
instruction it is returned for is believed to be independent on any
particular mode setting"

Honza
> 
> 
> r~

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-09 18:41           ` Richard Henderson
  2004-09-10  9:40             ` Jan Hubicka
@ 2004-09-10 10:10             ` Jan Hubicka
  2004-09-10 11:53               ` Suspicious lines in i386.md Uros Bizjak
  1 sibling, 1 reply; 14+ messages in thread
From: Jan Hubicka @ 2004-09-10 10:10 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, Arnaud Charlet, Nathan Sidwell,
	gcc, uros

Hi,
and actually forgot to add.  The reason why it stops exploding on EH is
described in lcm.c

	      /* If this is an abnormal edge, we'll insert at the end
		 of the previous block.  */
	      if (eg->flags & EDGE_ABNORMAL)
		{
		  emited = true;
		  if (JUMP_P (BB_END (src_bb)))
		    emit_insn_before (mode_set, BB_END (src_bb));
		  /* It doesn't make sense to switch to normal mode
		     after a CALL_INSN, so we're going to abort if we
		     find one.  The cases in which a CALL_INSN may
		     have an abnormal edge are sibcalls and EH edges.
		     In the case of sibcalls, the dest basic-block is
		     the EXIT_BLOCK, that runs in normal mode; it is
		     assumed that a sibcall insn requires normal mode
		     itself, so no mode switch would be required after
		     the call (it wouldn't make sense, anyway).  In
		     the case of EH edges, EH entry points also start
		     in normal mode, so a similar reasoning applies.  */

The new i386.h code broke the assumption about calls requiring "normal
mode" as they happent suddenly to be "don't care about mode".  The
reasoning about CALLs makes sense, but just the code bellow:

		  else if (NONJUMP_INSN_P (BB_END (src_bb)))
		    emit_insn_after (mode_set, BB_END (src_bb));
		  else
		    abort ();

strikes very wrong for case of non-call EH edges as we will miss the
mode change on EH case.

Actually even the emit before jump in the code above is wrong, it just
will happen to work by accident on i386 as we don't use mode switching
for actual CW change so we will change CW on the right place.  I think
we need to do non-lazy work and emit the mode change at the destination
of the edge.

Joern, Andrew, what do you think about this issue?

We also never worked for the case of fistp throwing exception in region
with mode changed.  I think it is not too serious as Java disable FP EH
and no one else uses non-call-exceptions, but only way to fix it I see
is to rescuesce the idea of lcm after reload idea I guess.

Cool alternatie would be to make EH edges redirectable.  I've pondered
about this for a while and discussed this with Richard who claimed this
to be easy, but I always failed miserably trying to implement this...

Honza

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Suspicious lines in i386.md
  2004-09-10 10:10             ` Jan Hubicka
@ 2004-09-10 11:53               ` Uros Bizjak
  2004-09-10 19:00                 ` Jan Hubicka
  0 siblings, 1 reply; 14+ messages in thread
From: Uros Bizjak @ 2004-09-10 11:53 UTC (permalink / raw)
  To: Jan Hubicka, gcc

Hello Jan!

There is something that catched my eye in i386.md:

in "*cmpfp_i",  "*cmpfp_i_sse", "*cmpfp_i_sse_only" patterns, there is a 
condition:

   && GET_MODE (operands[0]) == GET_MODE (operands[0])"

which looks like a typo to me. Another suspicious line is in 
"fix_truncdi_memory" pattern, where

  "* operands[5] = operands[4]; return output_fix_trunc (insn, operands);"

but operands[5] is not used in output_fix_trunc() function in i386.c

Should these lines be fixed, or are they intentionally written this way?

Uros.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Suspicious lines in i386.md
  2004-09-10 11:53               ` Suspicious lines in i386.md Uros Bizjak
@ 2004-09-10 19:00                 ` Jan Hubicka
  0 siblings, 0 replies; 14+ messages in thread
From: Jan Hubicka @ 2004-09-10 19:00 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Jan Hubicka, gcc

> Hello Jan!
> 
> There is something that catched my eye in i386.md:
> 
> in "*cmpfp_i",  "*cmpfp_i_sse", "*cmpfp_i_sse_only" patterns, there is a 
> condition:
> 
>   && GET_MODE (operands[0]) == GET_MODE (operands[0])"

Yes, this is obviously typo.  It probably meants that 
  && GET_MODE (operands[0]) == GET_MODE (operands[1])"
> 
> which looks like a typo to me. Another suspicious line is in 
> "fix_truncdi_memory" pattern, where
> 
>  "* operands[5] = operands[4]; return output_fix_trunc (insn, operands);"
> 
> but operands[5] is not used in output_fix_trunc() function in i386.c

This also looks like bug.  The output_fix_trunc changed several times,
so probably this is some kind of leftover.
> 
> Should these lines be fixed, or are they intentionally written this way?

Yes, these should be fixed.  Good catch ;)
Honza
> 
> Uros.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada broken on i686-linux
  2004-09-10  9:40             ` Jan Hubicka
@ 2004-09-10 19:07               ` Richard Henderson
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Henderson @ 2004-09-10 19:07 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, Arnaud Charlet, Nathan Sidwell, gcc, uros

On Fri, Sep 10, 2004 at 11:07:08AM +0200, Jan Hubicka wrote:
> See code concerning "no_mode" in lcm.c

Ah, yes, I see.  Patch ok then.


r~

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-09-10 18:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-09 10:28 Ada broken on i686-linux Arnaud Charlet
2004-09-09 10:41 ` Nathan Sidwell
2004-09-09 10:47   ` Arnaud Charlet
2004-09-09 16:14     ` Arnaud Charlet
2004-09-09 17:04       ` Arnaud Charlet
2004-09-09 17:24         ` Jan Hubicka
2004-09-09 18:41           ` Richard Henderson
2004-09-10  9:40             ` Jan Hubicka
2004-09-10 19:07               ` Richard Henderson
2004-09-10 10:10             ` Jan Hubicka
2004-09-10 11:53               ` Suspicious lines in i386.md Uros Bizjak
2004-09-10 19:00                 ` Jan Hubicka
2004-09-09 21:49           ` Ada broken on i686-linux (some progress) Laurent GUERBY
2004-09-10  9:38             ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).