This is the mail archive of the gcc@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] [tree-ssa] another miscompile due to BOOL_TYPE_SIZE being INT_TYPE_SIZE (bootstrap failure on ppc-apple-darwin)


On Sep 27, 2003, at 11:51, Andrew Pinski wrote:

There are places which check TYPE_MODE without also checking TYPE_PRECISION.
This causes a miscompile of gengtype on the second stage in powerpc-apple-darwin.
I tried to find the place which is causing this miscompile but I could not find it.
I made sure that it was BOOL_TYPE_SIZE being set to be the same as INT_TYPE_SIZE by
commenting it out in config/rs6000/darwin.h and then I was able to get passed
running gengtype.


Some more information, it is this function which is being miscompiled:
#define size_t unsigned long
struct
{
int line;
}lexer_line;
void update_lineno (const char *l, size_t len)
{
  while (len-- > 0)
    if (*l++ == '\n')
      lexer_line.line++;
}


In fact, the only thing different is the rtl which is emitted:
(The good one, which is when BOOL_TYPE_SIZE is set not to be the same as INT_TYPE_SIZE but the default):


;; Function update_lineno

(note 2 0 3 NOTE_INSN_DELETED)

(insn 3 2 4 (set (reg/v/f:SI 118 [ l ])
(reg:SI 3 r3 [ l ])) -1 (nil)
(expr_list:REG_EQUIV (mem/f:SI (reg/f:SI 113 virtual-incoming-args) [4 l+0 S4 A32])
(nil)))


(insn 4 3 5 (set (reg/v:SI 119 [ len ])
(reg:SI 4 r4 [ len ])) -1 (nil)
(expr_list:REG_EQUIV (mem/f:SI (plus:SI (reg/f:SI 113 virtual-incoming-args)
(const_int 4 [0x4])) [14 len+0 S4 A32])
(nil)))


(note 5 4 6 NOTE_INSN_FUNCTION_BEG)

(note 6 5 8 NOTE_INSN_DELETED)

(note 8 6 9 0xa9a9c0 NOTE_INSN_BLOCK_BEG)

(note 9 8 10 NOTE_INSN_DELETED)

(jump_insn 10 9 11 (set (pc)
        (label_ref 36)) -1 (nil)
    (nil))

(barrier 11 10 12)

(code_label 12 11 14 3 "" [0 uses])

(insn 14 12 15 (set:SI (reg:SI 125)
(zero_extend:SI (mem:QI (reg/v/f:SI 118 [ l ]) [0 S1 A8]))) -1 (nil)
(nil))


(insn 15 14 16 (set (reg:QI 124)
        (subreg:QI (reg:SI 125) 3)) -1 (nil)
    (nil))

(insn 16 15 17 (set (reg:SI 120 [ T.8 ])
        (sign_extend:SI (reg:QI 124))) -1 (nil)
    (nil))

(insn 17 16 18 (set (reg:CC 127)
        (compare:CC (reg:SI 120 [ T.8 ])
            (const_int 10 [0xa]))) -1 (nil)
    (nil))

(insn 18 17 19 (set (reg:SI 126)
        (eq:SI (reg:CC 127)
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(insn 19 18 20 (set (reg:SI 121 [ T.9 ])
        (reg:SI 126)) -1 (nil)
    (nil))

(insn 20 19 21 (set (reg/v/f:SI 118 [ l ])
        (plus:SI (reg/v/f:SI 118 [ l ])
            (const_int 1 [0x1]))) -1 (nil)
    (nil))

(insn 21 20 22 (set (reg:QI 128)				<--- the addition of this
        (subreg/s/u:QI (reg:SI 121 [ T.9 ]) 3)) -1 (nil)
    (nil))

(insn 22 21 23 (set (reg:SI 129)				<--- and the addition of this
        (zero_extend:SI (reg:QI 128))) -1 (nil)
    (nil))

(insn 23 22 24 (set (reg:CC 130)
        (compare:CC (reg:SI 129)
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(jump_insn 24 23 26 (set (pc)
        (if_then_else (eq (reg:CC 130)
                (const_int 0 [0x0]))
            (label_ref 35)
            (pc))) -1 (nil)
    (nil))

(insn 26 24 27 (use (symbol_ref:SI ("!d__lexer_line") <var_decl 0xa97e10 lexer_line>)) -1 (nil)
(nil))


(insn 27 26 28 (set:SI (reg:SI 132)
(plus:SI (reg:SI 31 r31)
(high:SI (const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))))) -1 (nil)
(nil))


(insn 28 27 29 (set (reg/u/f:SI 131)
(mem:SI (lo_sum:SI (reg:SI 132)
(const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))) [0 S4 A8])) -1 (nil)
(expr_list:REG_EQUAL (symbol_ref:SI ("!d__lexer_line") <var_decl 0xa97e10 lexer_line>)
(nil)))


(insn 29 28 30 (set (reg:SI 122 [ T.10 ])
(mem/s:SI (plus:SI (reg/u/f:SI 131)
(const_int 4 [0x4])) [5 lexer_line.line+0 S4 A32])) -1 (nil)
(nil))


(insn 30 29 31 (use (symbol_ref:SI ("!d__lexer_line") <var_decl 0xa97e10 lexer_line>)) -1 (nil)
(nil))


(insn 31 30 32 (set:SI (reg:SI 134)
(plus:SI (reg:SI 31 r31)
(high:SI (const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))))) -1 (nil)
(nil))


(insn 32 31 33 (set (reg/u/f:SI 133)
(mem:SI (lo_sum:SI (reg:SI 134)
(const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))) [0 S4 A8])) -1 (nil)
(expr_list:REG_EQUAL (symbol_ref:SI ("!d__lexer_line") <var_decl 0xa97e10 lexer_line>)
(nil)))


(insn 33 32 34 (set (reg:SI 135)
        (plus:SI (reg:SI 122 [ T.10 ])
            (const_int 1 [0x1]))) -1 (nil)
    (nil))

(insn 34 33 35 (set (mem/s:SI (plus:SI (reg/u/f:SI 133)
                (const_int 4 [0x4])) [5 lexer_line.line+0 S4 A32])
        (reg:SI 135)) -1 (nil)
    (nil))

(code_label 35 34 36 4 "" [0 uses])

(code_label 36 35 38 2 "" [0 uses])

(insn 38 36 39 (set (reg:CC 137)
        (compare:CC (reg/v:SI 119 [ len ])
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(insn 39 38 40 (set (reg:SI 136)
        (eq:SI (reg:CC 137)
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(insn 40 39 41 (set (reg:SI 123 [ T.11 ])
        (reg:SI 136)) -1 (nil)
    (nil))

(insn 41 40 42 (set (reg/v:SI 119 [ len ])
        (plus:SI (reg/v:SI 119 [ len ])
            (const_int -1 [0xffffffff]))) -1 (nil)
    (nil))

(insn 42 41 43 (set (reg:QI 138)
        (subreg/s/u:QI (reg:SI 123 [ T.11 ]) 3)) -1 (nil)
    (nil))

(insn 43 42 44 (set (reg:SI 139)
        (zero_extend:SI (reg:QI 138))) -1 (nil)
    (nil))

(insn 44 43 45 (set (reg:CC 140)
        (compare:CC (reg:SI 139)
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(jump_insn 45 44 46 (set (pc)
        (if_then_else (ne (reg:CC 140)
                (const_int 0 [0x0]))
            (label_ref 48)
            (pc))) -1 (nil)
    (nil))

(jump_insn 46 45 47 (set (pc)
        (label_ref 12)) -1 (nil)
    (nil))

(barrier 47 46 48)

(code_label 48 47 49 5 "" [0 uses])

(note 49 48 50 0xa9a9c0 NOTE_INSN_BLOCK_END)

(note 50 49 52 NOTE_INSN_FUNCTION_END)

(code_label 52 50 0 1 "" [0 uses])

(The bad version, which is when BOO_TYPE_SIZE is defined as INT_TYPE_SIZE):

;; Function update_lineno

(note 2 0 3 NOTE_INSN_DELETED)

(insn 3 2 4 (set (reg/v/f:SI 118 [ l ])
(reg:SI 3 r3 [ l ])) -1 (nil)
(expr_list:REG_EQUIV (mem/f:SI (reg/f:SI 113 virtual-incoming-args) [4 l+0 S4 A32])
(nil)))


(insn 4 3 5 (set (reg/v:SI 119 [ len ])
(reg:SI 4 r4 [ len ])) -1 (nil)
(expr_list:REG_EQUIV (mem/f:SI (plus:SI (reg/f:SI 113 virtual-incoming-args)
(const_int 4 [0x4])) [14 len+0 S4 A32])
(nil)))


(note 5 4 6 NOTE_INSN_FUNCTION_BEG)

(note 6 5 8 NOTE_INSN_DELETED)

(note 8 6 9 0x7f09c0 NOTE_INSN_BLOCK_BEG)

(note 9 8 10 NOTE_INSN_DELETED)

(jump_insn 10 9 11 (set (pc)
        (label_ref 34)) -1 (nil)
    (nil))

(barrier 11 10 12)

(code_label 12 11 14 3 "" [0 uses])

(insn 14 12 15 (set:SI (reg:SI 125)
(zero_extend:SI (mem:QI (reg/v/f:SI 118 [ l ]) [0 S1 A8]))) -1 (nil)
(nil))


(insn 15 14 16 (set (reg:QI 124)
        (subreg:QI (reg:SI 125) 3)) -1 (nil)
    (nil))

(insn 16 15 17 (set (reg:SI 120 [ T.8 ])
        (sign_extend:SI (reg:QI 124))) -1 (nil)
    (nil))

(insn 17 16 18 (set (reg:CC 127)
        (compare:CC (reg:SI 120 [ T.8 ])
            (const_int 10 [0xa]))) -1 (nil)
    (nil))

(insn 18 17 19 (set (reg:SI 126)
        (eq:SI (reg:CC 127)
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(insn 19 18 20 (set (reg:SI 121 [ T.9 ])
        (reg:SI 126)) -1 (nil)
    (nil))

(insn 20 19 21 (set (reg/v/f:SI 118 [ l ])
        (plus:SI (reg/v/f:SI 118 [ l ])
            (const_int 1 [0x1]))) -1 (nil)
    (nil))

(insn 21 20 22 (set (reg:CC 128)
        (compare:CC (reg:SI 121 [ T.9 ])
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(jump_insn 22 21 24 (set (pc)
        (if_then_else (eq (reg:CC 128)
                (const_int 0 [0x0]))
            (label_ref 33)
            (pc))) -1 (nil)
    (nil))

(insn 24 22 25 (use (symbol_ref:SI ("!d__lexer_line") <var_decl 0x7ede10 lexer_line>)) -1 (nil)
(nil))


(insn 25 24 26 (set:SI (reg:SI 130)
(plus:SI (reg:SI 31 r31)
(high:SI (const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))))) -1 (nil)
(nil))


(insn 26 25 27 (set (reg/u/f:SI 129)
(mem:SI (lo_sum:SI (reg:SI 130)
(const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))) [0 S4 A8])) -1 (nil)
(expr_list:REG_EQUAL (symbol_ref:SI ("!d__lexer_line") <var_decl 0x7ede10 lexer_line>)
(nil)))


(insn 27 26 28 (set (reg:SI 122 [ T.10 ])
(mem/s:SI (plus:SI (reg/u/f:SI 129)
(const_int 4 [0x4])) [5 lexer_line.line+0 S4 A32])) -1 (nil)
(nil))


(insn 28 27 29 (use (symbol_ref:SI ("!d__lexer_line") <var_decl 0x7ede10 lexer_line>)) -1 (nil)
(nil))


(insn 29 28 30 (set:SI (reg:SI 132)
(plus:SI (reg:SI 31 r31)
(high:SI (const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))))) -1 (nil)
(nil))


(insn 30 29 31 (set (reg/u/f:SI 131)
(mem:SI (lo_sum:SI (reg:SI 132)
(const:SI (minus:SI (symbol_ref:SI ("&L_lexer_line$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>"))))) [0 S4 A8])) -1 (nil)
(expr_list:REG_EQUAL (symbol_ref:SI ("!d__lexer_line") <var_decl 0x7ede10 lexer_line>)
(nil)))


(insn 31 30 32 (set (reg:SI 133)
        (plus:SI (reg:SI 122 [ T.10 ])
            (const_int 1 [0x1]))) -1 (nil)
    (nil))

(insn 32 31 33 (set (mem/s:SI (plus:SI (reg/u/f:SI 131)
                (const_int 4 [0x4])) [5 lexer_line.line+0 S4 A32])
        (reg:SI 133)) -1 (nil)
    (nil))

(code_label 33 32 34 4 "" [0 uses])

(code_label 34 33 36 2 "" [0 uses])

(insn 36 34 37 (set (reg:CC 135)
        (compare:CC (reg/v:SI 119 [ len ])
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(insn 37 36 38 (set (reg:SI 134)
        (eq:SI (reg:CC 135)
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(insn 38 37 39 (set (reg:SI 123 [ T.11 ])
        (reg:SI 134)) -1 (nil)
    (nil))

(insn 39 38 40 (set (reg/v:SI 119 [ len ])
        (plus:SI (reg/v:SI 119 [ len ])
            (const_int -1 [0xffffffff]))) -1 (nil)
    (nil))

(insn 40 39 41 (set (reg:CC 136)
        (compare:CC (reg:SI 123 [ T.11 ])
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(jump_insn 41 40 42 (set (pc)
        (if_then_else (ne (reg:CC 136)
                (const_int 0 [0x0]))
            (label_ref 44)
            (pc))) -1 (nil)
    (nil))

(jump_insn 42 41 43 (set (pc)
        (label_ref 12)) -1 (nil)
    (nil))

(barrier 43 42 44)

(code_label 44 43 45 5 "" [0 uses])

(note 45 44 46 0x7f09c0 NOTE_INSN_BLOCK_END)

(note 46 45 48 NOTE_INSN_FUNCTION_END)

(code_label 48 46 0 1 "" [0 uses])


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