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]

problem on solaris2.6


Hello,

Some time ago I sent a bug report about compilation problems on
sparc-sun-solaris2.6. The code:

long double
bug(long double src)
{
	if (src > -0.1 && src < 0.1) {
		int i;
		long double r = 1.0;
		long double k = 1.0;
		long double s = 0.0;
		for (i = 1 ; i < 10 ; i++) {
			r *= src;
			k *= (long double)i;
			s += r / k;
		}
		src = s;
	}
	return src;
}

generates the output below when compiled with -O2:

bug.c: In function `bug':
bug.c:17: Internal compiler error in schedule_insns, at sched-rgn.c:3070
Please submit a full bug report, with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

I did debug this problem and found that the patch:

2001-03-09 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>

	* combine.c (combine_instructions): Call update_life_info with 
	PROP_KILL_DEAD_CODE and PROP_SCAN_DEAD_CODE to correctly update
	the REG_DEAD info.

--- combine.c.org	Fri Mar  9 19:10:42 2001
+++ combine.c	Fri Mar  9 19:10:30 2001
@@ -742,7 +742,8 @@ combine_instructions (f, nregs)
     {
       compute_bb_for_insn (get_max_uid ());
       update_life_info (refresh_blocks, UPDATE_LIFE_GLOBAL_RM_NOTES,
-			PROP_DEATH_NOTES);
+			PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
+			| PROP_SCAN_DEAD_CODE);
     }
 
   /* Clean up.  */

fixes the problem. I am not sure if this is the correct patch. Maybe there
is something wrong in flow.c.

The problem is that combine is deleting an insn that looks like:

(insn 166 164 170 (set (reg/v:TF 156)
        (reg/v:TF 128)) 97 {*movtf_insn_sp32} (nil)
    (expr_list:REG_DEAD (reg/v:TF 128)
        (insn_list:REG_LIBCALL 183 (nil))))

The register 128 is not set in the current basic block. This means we
have to rerun flow to update the REG_DEAD info of the basic block this
insn came from. I do not know why we have to set PROP_KILL_DEAD_CODE and
PROP_SCAN_DEAD_CODE to accomplish this. I need to set both flow options
otherwise the problem remains.

Without the patch the code that sets register 128 is (from combine dump file):

(insn 79 77 82 (set (reg/v:TF 128)
        (mem/u/f:TF (reg/f:SI 129) 4)) 97 {*movtf_insn_sp32} (insn_list 77 (nil))
    (expr_list:REG_DEAD (reg/f:SI 129)
        (expr_list:REG_UNUSED (reg/v:TF 128)
            (expr_list:REG_EQUAL (const_double:TF (mem/u/f:TF (symbol_ref/u:SI ("*.LLC3")) 4) 0 [0x0] 0 [0x0] 0 [0x0] 0 [0x0] 0 [0x0])
                (nil)))))

With the patch applied this insn is deleted because register 128 is ununsed.

	Herman.


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