Bug 11516 - [3.4 regression] miscompiled of genattrtab.c in stage2
Summary: [3.4 regression] miscompiled of genattrtab.c in stage2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P1 critical
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
URL:
Keywords: build, wrong-code
Depends on:
Blocks:
 
Reported: 2003-07-14 01:10 UTC by John David Anglin
Modified: 2010-10-27 17:02 UTC (History)
2 users (show)

See Also:
Host: hppa64-hppa-hpux11.11
Target: hppa64-hppa-hpux11.11
Build: hppa64-hppa-hpux11.11
Known to work:
Known to fail:
Last reconfirmed: 2003-07-14 02:11:58


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2003-07-14 01:10:06 UTC
stage1/xgcc -Bstage1/ -B/opt/gnu64/hppa64-hp-hpux11.11/bin/   -g -O2 -DIN_GCC
-W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno
-long-long -Werror -fno-common   -DHAVE_CONFIG_H  -o cc1 \
        c-parse.o c-lang.o c-pretty-print.o attribs.o c-errors.o c-lex.o c-pragm
a.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o
c-semantics.o c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o c-ob
jc-common.o c-dump.o c-pch.o libcpp.a  main.o libbackend.a ../libiberty/libibert
y.a
ld: Unsatisfied symbol "get_attr_pa_combine_type" in file libbackend.a[pa.o]
ld: Unsatisfied symbol "get_attr_type" in file libbackend.a[pa.o]
2 errors.
collect2: ld returned 1 exit status
Comment 1 Andrew Pinski 2003-07-14 01:56:57 UTC
I think this is caused by Keating's patch for intermodule optimizations.
I could not reproduce this with a cross-compiler from powerpc-apple-darwin6.6 with the mainline.  
I also do not have access to HP-UX. Does the file insn-attrtab.c have the functions 
get_attr_pa_combine_type and get_attr_type defined in there?  Also does the line building the 
library libbackend.a have insn-attrtab.o included?  Also what does nm say for insn-attrtab.o, are 
get_attr_pa_combine_type and get_attr_type defined?
Comment 2 dave 2003-07-14 02:06:36 UTC
Subject: Re:  [3.4 egression] ld: Unsatisfied symbol "get

> I also do not have access to HP-UX. Does the file insn-attrtab.c have the
> functions 
> get_attr_pa_combine_type and get_attr_type defined in there?  Also does the

The functions are present in insn-attrtab.c in stage 1 but not stage 2.

> line building the 
> library libbackend.a have insn-attrtab.o included?  Also what does nm say

Yes.

> for insn-attrtab.o, are 
> get_attr_pa_combine_type and get_attr_type defined?

They are in stage 1 but not stage 2.

Thanks for the suggestion as to which patch may have introduced the problem.
The port hasn't been buildable for the last several weeks due to one problem
after another, so it was going to be difficult to determine which patch
caused the regression.

Dave
Comment 3 Andrew Pinski 2003-07-14 02:11:58 UTC
Actually it does not look like his patch caused this because if it was his patch, then they would be 
present. It looks like genattrtab.c is being miscompiled.  Thanks for looking into the files because 
that narrowed down the search on what is going wrong.
Comment 4 dave 2003-07-14 04:32:26 UTC
Subject: Re:  [3.4 egression] ld: Unsatisfied symbol "get

> present. It looks like genattrtab.c is being miscompiled.  Thanks for

Yes, the problem is limited to the 64-bit hpux port.

Dave
Comment 5 Andrew Pinski 2003-07-15 20:13:56 UTC
Can you try a bootstrap with the following patch reverted (it is also causing problems on 
sparc-sun-solaris2.8)?
2003-07-13  Kazu Hirata

        * combine.c (simplify_comparison): Convert (ne (and (not X) 1) 0)
        to (eq (and X 1) 0).
<http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01358.html>
If that fixes it can you report to him that he also broke hppa64-hppa-hpux11.11 and 
pointing him to this bug report.
Comment 6 dave 2003-07-16 06:51:17 UTC
Subject: Re:  [3.4 regression] miscompiled of genattrtab.c i

> Can you try a bootstrap with the following patch reverted (it is also
> causing problems on 
> sparc-sun-solaris2.8)?
> 2003-07-13  Kazu Hirata
> 
>         * combine.c (simplify_comparison): Convert (ne (and (not X) 1) 0)
>         to (eq (and X 1) 0).
> <http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01358.html>
> If that fixes it can you report to him that he also broke
> hppa64-hppa-hpux11.11 and 
> pointing him to this bug report.

Reversing the patch seemed to have some effect on the problem.
get_attr_pa_combine_type is now generated in the stage2 version of
insn-attrtab.c.  However, get_attr_type is still missing:

ld: Unsatisfied symbol "get_attr_type" in file libbackend.a[pa.o]

Dave
Comment 7 John David Anglin 2003-07-20 07:29:51 UTC
The regression was introduced by the following patch:

2003-07-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

        * genattrtab.h: Add new macros for attr `special' flags.
        * genattrtab.c (attr_desc): Reorder/resize fields better.
        Use attr `special' macros in all calls to make_internal_attr.
        * genautomata.c: Likewise.
Comment 8 Kaveh Ghazi 2003-07-21 16:09:48 UTC
Subject: Re:  [3.4 regression] miscompiled of genattrtab.c in stage2

 > The regression was introduced by the following patch:
 > 
 > 2003-07-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 > 
 >         * genattrtab.h: Add new macros for attr `special' flags.
 >         * genattrtab.c (attr_desc): Reorder/resize fields better.
 >         Use attr `special' macros in all calls to make_internal_attr.
 >         * genautomata.c: Likewise.


Hmmm, while you may have first seen a problem after my patch was
introduced, I can't see how the patch could be the root cause of any
problem you have.  There must be something elsewhere where the bug
lies.  As you said, the problem is in stage2 so there is a deeper
miscompilation occuring IMHO.  I understand and support our policy
regarding one patch uncovering a latent bug elsewhere, but the changes
I introduce are so innocuous that I believe you should fix the root
cause rather than invoke the policy to remove my patch.

As a test I reverted these two patches:
http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00653.html
http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00575.html

and built insn-attrtab.c in a cross-configuration targetted to
hppa64-hppa-hpux11.11.  The differences in the generated file from the
reverted case and current CVS are all expected and simple.  Some
redundant prototypes are removed, `internal_dfa_insn_code' is made
static and `internal_reset' in made inline.  No other changes.

If I can be of assistance let me know, but I don't have access to hpux
so I can't investigate a stage2 miscompilation.


--- hpux-revert/build/gcc/insn-attrtab.c	2003-07-21 11:40:08.203855000 -0400
+++ hpux-current/build/gcc/insn-attrtab.c	2003-07-21 11:41:01.238773000 -0400
@@ -21,3 +21,2 @@ from the machine description file `md'. 
 
-extern int insn_current_length (rtx);
 int
@@ -584,3 +583,2 @@ insn_current_length (rtx insn ATTRIBUTE_
 
-extern int insn_variable_length_p (rtx);
 int
@@ -633,3 +631,2 @@ insn_variable_length_p (rtx insn ATTRIBU
 
-extern int insn_default_length (rtx);
 int
@@ -992,3 +989,2 @@ insn_default_length (rtx insn ATTRIBUTE_
 
-extern int bypass_p (rtx);
 int
@@ -1184,3 +1180,2 @@ bypass_p (rtx insn ATTRIBUTE_UNUSED)
 
-extern int insn_default_latency (rtx);
 int
@@ -1995,3 +1990,2 @@ insn_default_latency (rtx insn ATTRIBUTE
 #if AUTOMATON_ALTS
-extern int insn_alts (rtx);
 int
@@ -2673,4 +2667,3 @@ insn_alts (rtx insn ATTRIBUTE_UNUSED)
 
-extern int internal_dfa_insn_code (rtx);
-int
+static int
 internal_dfa_insn_code (rtx insn ATTRIBUTE_UNUSED)
@@ -4314,3 +4307,2 @@ internal_dfa_insn_code (rtx insn ATTRIBU
 
-extern int result_ready_cost (rtx);
 int
@@ -4330,3 +4322,2 @@ result_ready_cost (rtx insn ATTRIBUTE_UN
 
-extern int function_units_used (rtx);
 int
@@ -4346,3 +4337,2 @@ function_units_used (rtx insn ATTRIBUTE_
 
-extern int num_delay_slots (rtx);
 int
@@ -4432,3 +4422,2 @@ num_delay_slots (rtx insn ATTRIBUTE_UNUS
 
-extern enum attr_in_call_delay get_attr_in_call_delay (rtx);
 enum attr_in_call_delay
@@ -4646,3 +4635,2 @@ get_attr_in_call_delay (rtx insn ATTRIBU
 
-extern enum attr_in_nullified_branch_delay get_attr_in_nullified_branch_delay (rtx);
 enum attr_in_nullified_branch_delay
@@ -4870,3 +4858,2 @@ get_attr_in_nullified_branch_delay (rtx 
 
-extern enum attr_in_branch_delay get_attr_in_branch_delay (rtx);
 enum attr_in_branch_delay
@@ -5074,3 +5061,2 @@ get_attr_in_branch_delay (rtx insn ATTRI
 
-extern enum attr_pa_combine_type get_attr_pa_combine_type (rtx);
 enum attr_pa_combine_type
@@ -5116,3 +5102,2 @@ get_attr_pa_combine_type (rtx insn ATTRI
 
-extern enum attr_type get_attr_type (rtx);
 enum attr_type
@@ -12268,3 +12253,3 @@ state_size (void)
 
-static void
+static inline void
 internal_reset (struct DFA_chip *chip)
Comment 9 dave 2003-07-21 16:37:57 UTC
Subject: Re:  [3.4 regression] miscompiled of genattrtab.c i

> Hmmm, while you may have first seen a problem after my patch was
> introduced, I can't see how the patch could be the root cause of any
> problem you have.  There must be something elsewhere where the bug

Yes, your patch is not the problem.  It's was a problem I introduced
a couple of days before :(  The main was a real mess at the time and
it was difficult to determine what the cause was.  Your patch just
changed the symptoms.  I'm testing a fix now.

Thanks for your comments.

Dave
Comment 10 GCC Commits 2003-07-23 15:18:48 UTC
Subject: Bug 11516

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	danglin@gcc.gnu.org	2003-07-23 15:18:38

Modified files:
	gcc            : ChangeLog 
	gcc/config/pa  : pa.md 

Log message:
	PR target/11607 and PR target/11516
	* pa.md (extzv, extv, insv): Revert latter half of last patch.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.683&r2=1.16114.2.684
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/pa/pa.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.116.2.10&r2=1.116.2.11

Comment 11 GCC Commits 2003-07-23 15:53:34 UTC
Subject: Bug 11516

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	danglin@gcc.gnu.org	2003-07-23 15:53:31

Modified files:
	gcc            : ChangeLog 
	gcc/config/pa  : pa.md 

Log message:
	PR target/11607 and PR target/11516
	* pa.md (extzv, extv, insv): Revert latter half of last patch.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.600&r2=2.601
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/pa/pa.md.diff?cvsroot=gcc&r1=1.127&r2=1.128

Comment 12 John David Anglin 2003-07-23 16:11:17 UTC
Fixed.
http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02312.html