public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/15381] New: Bootstrap comparison failure!
@ 2004-05-12 14:30 danglin at gcc dot gnu dot org
  2004-05-12 14:31 ` [Bug optimization/15381] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-05-12 14:30 UTC (permalink / raw)
  To: gcc-bugs

Bootstrap comparison failure!
./c-cppbuiltin.o differs
./cfg.o differs
./gcc.o differs
./gcov.o differs
./genautomata.o differs
./hashtable.o differs
./predict.o differs
./real.o differs
./sched-rgn.o differs
./timevar.o differs
./tracer.o differs
make[1]: *** [gnucompare] Error 1

504 (hiauly1)dave> ./xgcc -B./ -v
Reading specs from ./specs
Configured with: ../gcc/configure --with-gnu-as --with-as=/usr/local/bin/as --en
able-shared --prefix=/opt/gnu/gcc/gcc-3.5 --with-local-prefix=/usr/local --disab
le-nls --enable-debug=no --enable-languages=c
Thread model: single
gcc version 3.5.0 20040508 (experimental)

The same problem can be duplicated on a PA 2.0 by configuring using the
--with-schedule=7100LC option.

The problem was introduced by the following patch:

2004-04-09  Caroline Tice  <ctice@apple.com>

        * basic-block.h (struct edge_def):  Add new field, crossing_edge.
        (struct basic_block_def):  Add new field, partition.
        (UNPARTITIONED, HOT_PARTITION, COLD_PARTITION):  New constant macro
        definitions.
        (partition_hot_cold_basic_blocks): Add extern function 
        declaration.
        * bb-reorder.c (function.h, obstack.h, expr.h, regs.h):  Add four new 
        include statements.
        (N_ROUNDS): Increase the maximum number of rounds by 1.
        (branch_threshold): Add array value for new round.
        (exec_threshold): Add array value for new round.
        (push_to_next_round_p): New function.
        (add_unlikely_executed_notes): New function.
        (find_rarely_executed_basic_blocks_and_crossing_edges): New function.
        (mark_bb_for_unlikely_executed_section): New function.
        (add_labels_and_missing_jumps): New function.
        (add_reg_crossing_jump_notes): New function.
        (fix_up_fall_thru_edges): New function.
        (find_jump_block): New function.
        (fix_crossing_conditional_branches): New function.
        (fix_crossing_unconditional_branches): New function.
        (fix_edges_for_rarely_executed_code): New function.
        (partition_hot_cold_basic_blocks): New function.
        (find_traces):  Add an extra round for partitioning hot/cold
        basic blocks.
        (find_traces_1_round): Add a parameter.  Modify to push all cold blocks,
        and only cold blocks, into the last (extra) round of collecting traces.
        (better_edge_p): Add a parameter.  Modify to favor non-crossing edges 
        over crossing edges.
        (bb_to_key):  Add code to correctly identify cold blocks when 
        doing partitioning.
        (connect_traces): Modify to connect all the non-cold traces first, then
        go back and connect up all the cold traces.
        (reorder_basic_blocks):  Add call to add_unlikely_executed_notes.
        * cfg.c (entry_exit_blocks): Add initialization for partition field in
        entry and exit blocks.
        * cfgbuild.c (make_edges): Update current_function_has_computed_jump  
        if we are doing hot/cold partitioning.
        * cfgcleanup.c (cfglayout.h): Add new include statement.
        (try_simplify_condjump): Modify to not attempt on blocks with jumps 
        that cross section boundaries.
        (try_forward_edges): Likewise.
        (merge_blocks_move_predecessor_nojumps): Likewise.
        (merge_blocks_move_successor_nojumps): Likewise.
        (merge_blocks_move): Likewise.
        (try_crossjump_to_edge): Modify to not attempt after we have done
        the block partitioning.
        (try_crossjump_bb): Modify to not attempt on blocks with jumps that
        cross section boundaries.
        (try_optimize_cfg): Likewise.
        * cfghooks.c (tidy_fallthru_edges): Modify to not remove indirect
        jumps that cross section boundaries.
        * cfglayout.c (flags.h): Add new include statement.
        (update_unlikely_executed_notes):  New function.
        (fixup_reorder_chain):  Add code so when a new jumping basic block is 
        added, it's UNLIKELY_EXECUTED_CODE and REG_CROSSING_JUMP notes are 
        updated appropriately.
        (duplicate_insn_chain):  Add code to duplicate the new NOTE insn
        introduced by this optimization.
        * cfglayout.h (scan_ahead_for_unlikely_executed_note):  Add new 
        extern function declaration.
        * cfgrtl.c (can_delete_note_p):  Add NOTE_INSN_UNLIKELY_EXECUTED_CODE to
        list of notes that can be deleted.
        (create_basic_block_structure):  Add initialization for partition field.
        (rtl_can_merge_blocks):  Modify to test blocks for jumps that cross
        section boundaries.
        (try_redirect_by_replacing_jump):  Modify to not attempt on jumps that
        cross section boundaries.
        (commit_one_edge_insertion): Add code so newly created basic block
        ends up in correct (hot or cold) section.  Modify to disallow 
        insertions before NOTE_INSN_UNLIKELY_EXECUTED_CODE notes.
        (rtl_verify_flow_info_1):  Add code to verify that no fall_thru edge
        crosses section boundaries.
        (cfg_layout_can_merge_blocks_p): Modify to test blocks for jumps that
        cross section boundaries.
        (force_nonfallthru_and_redirect): Modify to make sure new basic block
        ends up in correct section, with correct notes attached.
        * common.opt (freorder-blocks-and-partition):  Add new flag for this 
        optimization.
        * dbxout.c (dbx_function_end):  Add code to make sure scope labels at
        the end of functions are written into the correct (hot or cold) 
        section.
        (dbx_source_file): Add code so writing debug file information
        doesn't incorrectly change sections.
        * defaults.h (NORMAL_TEXT_SECTION_NAME): New constant macro, for use
        in partitioning hot/cold basic blocks into separate sections.
        (SECTION_FORMAT_STRING): New constant macro, for linux/i386 hot/cold 
        section partitioning.
        (HAS_LONG_COND_BRANCH): New constant macro, indicating whether or not
        conditional branches can span all of memory.
        (HAS_LONG_UNCOND_BRANCH): New constant macro, indicationg whether or not
        unconditional branches can span all of memory.
        * final.c (scan_ahead_for_unlikely_executed_note):  New function.
        (final_scan_insn):  Add code to check for NOTE instruction indicating 
        whether basic block belongs in hot or cold section, and to make sure 
        the current basic block is being written to the appropriate section.  
        Also added code to ensure that jump table basic blocks end up in the 
        correct section.
        * flags.h (flag_reorder_blocks_and_partition):  New flag.
        * ifcvt.c (find_if_case_1):  Modify to not attempt if conversion if
        one of the branches has a jump that crosses between sections.
        (find_if_case_2): Likewise.
        (ifcvt): Modify to not attempt to mark loop exit edges after 
        hot/cold partitioning has occurred.
        * opts.c (decode_options): Code to handle new flag, 
        flag_reorder_blocks_and_partition; also to turn it off if
        flag_exceptions is on.
        (common_handle_option): Code to handle new flag, 
        flag_reorder_blocks_and_partition.
        * output.h (unlikely_text_section): New extern function declaration.
        (in_unlikely_text_section): New extern function declaration.
        * passes.c (rest_of_handle_stack_regs):  Add 
        flag_reorder_blocks_and_partition as an 'or' condition for calling 
        reorder_basic_blocks.
        (rest_of_handle_reorder_blocks):  Add flag_reorder_blocks_and_partition 
        as an 'or' condition for calling reorder_basic_blocks.
        (rest_of_compilation):  Add call to partition_hot_cold_basic_blocks.
        * print-rtl.c (print_rtx): Add code for handling new note,
        NOTE_INSN_UNLIKELY_EXECUTED_CODE
        * rtl.c  (NOTE_INSN_UNLIKELY_EXECUTED_CODE): New note insn (see below).
        (REG_CROSSING_JUMP): New kind of reg_note, to mark jumps that
        cross between section boundaries.
        * rtl.h (NOTE_INSN_UNLIKELY_EXECUTED_CODE):  New note instruction, 
        indicating the basic block containing it belongs in the cold section.
        (REG_CROSSING_JUMP): New type of reg_note, to mark jumps that cross
        between hot and cold sections.
        * toplev.c (flag_reorder_blocks_and_partition):  Add code to 
        initialize this flag, and to tie it to the command-line option 
        freorder-blocks-and-partition.
        * varasm.c (cfglayout.h):  Add new include statement.
        (unlikely_section_label_printed):  New global variable, used for 
        determining when to output section name labels for cold sections.
        (in_section):  Add in_unlikely_executed_text to enum data structure.
        (text_section):  Modify code to use SECTION_FORMAT_STRING and
        NORMAL_TEXT_SECTION_NAME macros.
        (unlikely_text_section):  New function.
        (in_unlikely_text_section):  New function.
        (function_section):  Add code to make sure beginning of function is 
        written into correct section (hot or cold).
        (assemble_start_function):  Add code to make sure stuff is written to 
        the correct section.
        (assemble_zeros):  Add in_unlikely_text_section as an 'or' condition 
        to an if statement that was checking 'in_text_section'.
        (assemble_variable):  Add 'in_unlikely_text_section' as an 'or' 
        condition to an if statement that was checking 'in_text_section'.
        (default_section_type_flags_1):  Add check: if in cold section 
        flags = SECTION_CODE.
        * config/darwin.c (darwin_asm_named_section):  Modify to use
        SECTION_FORMAT_STRING if we are partitioning hot/cold blocks.
        * config/i386/i386.h (HAS_LONG_COND_BRANCH): Defined this macro 
        specifically for the i386.
        (HAS_LONG_UNCOND_BRANCH):  Defined this macro specifically for the i386.
        * config/rs6000/darwin.h (UNLIKELY_EXECUTED_TEXT_SECTION_NAME): Change
        text string to something more informative.
        (NORMAL_TEXT_SECTION_NAME): Add new definition.
        (SECTION_FORMAT_STRING):  Add new definition.
        * config/rs6000/rs6000.c (rs6000_assemble_integer):  Add 
        '!in_unlikely_text_section' as an 'and' condition to an if statement 
        that was already checking '!in_text_section'.
        * config/rs6000/sysv4.h (HOT_TEXT_SECTION_NAME,NORMAL_TEXT_SECTION_NAME,
        UNLIKELY_EXECUTED_TEXT_SECTION_NAME,SECTION_FORMAT_STRING): Make
        sure these are properly defined for linux on ppc.
        * doc/invoke.texi  (freorder-blocks-and-partition): Add documentation 
        for this new flag.
        * doc/rtl.texi (REG_CROSSING_JUMP):  Add documentation for new
        reg_note.
        * doc/tm.texi (NORMAL_TEXT_SECTION_NAME, SECTION_FORMAT_STRING, 
        HAS_LONG_COND_BRANCH, HAS_LONG_UNCOND_BRANCH): Add documentation for 
        these new macros.

In testing, I also had these two patches installed:

2004-05-05  Jan Hubicka  <jh@suse.cz>

        PR opt/14980
        * cgraphunit.c (cgraph_remove_unreachable_nodes): Deal properly with
        inline clones.

2004-04-11  Andrew Pinski  <pinskia@physics.uc.edu>

        * varasm.c (text_section): Use TEXT_SECTION_ASM_OP and
        ASM_OUTPUT_ALIGN instead of SECTION_FORMAT_STRING
        and NORMAL_TEXT_SECTION_NAME.
        (unlikely_text_section): Check targetm.have_named_sections
        instead of TARGET_ASM_NAMED_SECTION and use TEXT_SECTION_ASM_OP
        instead of SECTION_FORMAT_STRING.
        * config/mips/iris5.h (current_section_name): Add
        in_unlikely_executed_text case and move the abort into the switch.
        * config/rs6000/sysv4.h (HOT_TEXT_SECTION_NAME): Remove.
        (NORMAL_TEXT_SECTION_NAME): Remove.
        (UNLIKELY_EXECUTED_TEXT_SECTION_NAME): Remove.
        (SECTION_FORMAT_STRING): Remove.
        * defaults.h (SECTION_FORMAT_STRING): Remove.
        * tm.texi (NORMAL_TEXT_SECTION_NAME): Remove.
        (SECTION_FORMAT_STRING): Remove.

The difference in the assembly output for timevar.c in stages 2 and 3 is:

# diff -u3p timevar.s.2 timevar.s.3
--- timevar.s.2 Tue May 11 13:30:39 2004
+++ timevar.s.3 Tue May 11 13:30:03 2004
@@ -1721,8 +1721,8 @@ L$C0071
        .STRING "Configure with --disable-checking to disable checks.\x0a\x00"
        .align 8
 L$C0061
-       .word   1064598241
-       .word   1202590843
+       .word   1075052544
+       .word   0
        .align 8
 L$C0064
        .word   1079574528
@@ -2125,11 +2125,7 @@ L$C0085
        .word   1079574528
        .word   0
        .align 8
-L$C0086
-       .word   1071644672
-       .word   0
-       .align 8
-L$C0090
+L$C0088
        .word   0
        .word   1125899907
        .SPACE $TEXT$
@@ -2160,8 +2156,8 @@ L$M292:
        copy %r25,%r3
        .stabn 68,0,517,L$M293-print_time
 L$M293:
-       ldil LR'L$C0090,%r21
-       ldo RR'L$C0090(%r21),%r21
+       ldil LR'L$C0088,%r21
+       ldo RR'L$C0088(%r21),%r21
        extrs %r3,0,1,%r23
        fldds 0(%r21),%fr22
        ldil L'1125892096,%r21
@@ -2193,20 +2189,18 @@ L$M293:
        movb,= %r28,%r28,L$0079
        stw %r19,-52(%r30)
        stw %r28,-16(%r30)
-       fcnvxf,sgl,dbl %fr23L,%fr22
        ldil LR'L$C0085,%r19
-       fldws -16(%r30),%fr23L
        ldo RR'L$C0085(%r19),%r19
-       fcnvxf,sgl,dbl %fr23L,%fr24
-       fldds 0(%r19),%fr23
-       ldil LR'L$C0086,%r19
-       ldo RR'L$C0086(%r19),%r19
-       fmpy,dbl %fr22,%fr23,%fr22
-       fldds 0(%r19),%fr23
-       fdiv,dbl %fr22,%fr24,%fr22
-       fadd,dbl %fr22,%fr23,%fr22
-       fcnvfxt,dbl,sgl %fr22,%fr22L
-       fstws %fr22L,-16(%r30)
+       fcnvxf,sgl,dbl %fr23L,%fr23
+       fldws -16(%r30),%fr22R
+       fcnvxf,sgl,dbl %fr22R,%fr24
+       fldds 0(%r19),%fr22
+       fmpy,dbl %fr23,%fr22,%fr23
+       fcpy,dbl %fr0,%fr22
+       fdiv,dbl %fr23,%fr24,%fr23
+       fadd,dbl %fr23,%fr22,%fr23
+       fcnvfxt,dbl,sgl %fr23,%fr23L
+       fstws %fr23L,-16(%r30)
        ldw -16(%r30),%r20
 L$0079
        .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR

This seems to indicate the problem relates to a miscompilation of the
code that outputs floating point constants.

-- 
           Summary: Bootstrap comparison failure!
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: danglin at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa1.1-hp-hpux10.20
  GCC host triplet: hppa1.1-hp-hpux10.20
GCC target triplet: hppa1.1-hp-hpux10.20


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15381


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

* [Bug optimization/15381] [3.5 Regression] Bootstrap comparison failure!
  2004-05-12 14:30 [Bug c/15381] New: Bootstrap comparison failure! danglin at gcc dot gnu dot org
@ 2004-05-12 14:31 ` pinskia at gcc dot gnu dot org
  2004-05-12 15:26 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-12 14:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |optimization
           Keywords|                            |wrong-code
            Summary|Bootstrap comparison        |[3.5 Regression] Bootstrap
                   |failure!                    |comparison failure!
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15381


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

* [Bug optimization/15381] [3.5 Regression] Bootstrap comparison failure!
  2004-05-12 14:30 [Bug c/15381] New: Bootstrap comparison failure! danglin at gcc dot gnu dot org
  2004-05-12 14:31 ` [Bug optimization/15381] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-05-12 15:26 ` dave at hiauly1 dot hia dot nrc dot ca
  2004-05-13 13:25 ` danglin at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-05-12 15:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-05-11 18:34 -------
Subject: Re:  [3.5 Regression] Bootstrap comparison fa

The following test program is miscompiled by the stage3 compiler:

double
foo (void)
{
  return 0.5;
}

It results in the following assembly code:

        bv %r0(%r2)
	fcpy,dbl %fr0,%fr4

The above code returns 0. (%fr0) instead of 0.5.

Dave


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15381


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

* [Bug optimization/15381] [3.5 Regression] Bootstrap comparison failure!
  2004-05-12 14:30 [Bug c/15381] New: Bootstrap comparison failure! danglin at gcc dot gnu dot org
  2004-05-12 14:31 ` [Bug optimization/15381] [3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-05-12 15:26 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2004-05-13 13:25 ` danglin at gcc dot gnu dot org
  2004-05-21 17:16 ` [Bug rtl-optimization/15381] " pinskia at gcc dot gnu dot org
  2004-06-22  1:43 ` danglin at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-05-13 13:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From danglin at gcc dot gnu dot org  2004-05-13 01:59 -------
This appears to be a bug in reorg, possibly related to the recent fix for
PR optimization/15296.  The miscompilation of the test program occurs
because cpp_classify_number in cppexp.c has been miscompiled:

        .stabn 68,0,98,L$M31-cpp_classify_number
L$M31:
        addl %r24,%r25,%r19
        comib,<< 1,%r19,L$0142
        ldil LR'L$C0005,%r24
        comib,<< 1,%r23,L$0142
        ldi 0,%r19
        comiclr,= 0,%r23,%r0
        ldil L'8192,%r19
        copy %r19,%r6
        comib,<> 0,%r24,L$0051
        depi -1,27,1,%r6

The "ldil" in the delay slot of the first "comib" incorrectly clobbers
%r24 in the fallthru path.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15381


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

* [Bug rtl-optimization/15381] [3.5 Regression] Bootstrap comparison failure!
  2004-05-12 14:30 [Bug c/15381] New: Bootstrap comparison failure! danglin at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-05-13 13:25 ` danglin at gcc dot gnu dot org
@ 2004-05-21 17:16 ` pinskia at gcc dot gnu dot org
  2004-06-22  1:43 ` danglin at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-21 17:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-20 16:46 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01269.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-20 16:46:44
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15381


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

* [Bug rtl-optimization/15381] [3.5 Regression] Bootstrap comparison failure!
  2004-05-12 14:30 [Bug c/15381] New: Bootstrap comparison failure! danglin at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-05-21 17:16 ` [Bug rtl-optimization/15381] " pinskia at gcc dot gnu dot org
@ 2004-06-22  1:43 ` danglin at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-06-22  1:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From danglin at gcc dot gnu dot org  2004-06-22 01:43 -------
Fixed in 3.5.  See patch mentioned in comment #3.

The problem is also present in 3.3 and 3.4.  However, there
is no testcase to trigger it. 


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at acm dot org, mark at
                   |                            |codesourcery dot com
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15381


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

end of thread, other threads:[~2004-06-22  1:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-12 14:30 [Bug c/15381] New: Bootstrap comparison failure! danglin at gcc dot gnu dot org
2004-05-12 14:31 ` [Bug optimization/15381] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-05-12 15:26 ` dave at hiauly1 dot hia dot nrc dot ca
2004-05-13 13:25 ` danglin at gcc dot gnu dot org
2004-05-21 17:16 ` [Bug rtl-optimization/15381] " pinskia at gcc dot gnu dot org
2004-06-22  1:43 ` danglin at gcc dot gnu dot org

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).