Bug 23991 - [4.1 Regression]: Gcc failed to build on ia64
Summary: [4.1 Regression]: Gcc failed to build on ia64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2005-09-21 10:01 UTC by H.J. Lu
Modified: 2005-09-23 12:50 UTC (History)
2 users (show)

See Also:
Host: ia64-unknown-linux-gnu
Target: ia64-unknown-linux-gnu
Build: ia64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-09-21 11:28:43


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2005-09-21 10:01:52 UTC
This patch:

http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01279.html

breaks ia64. I got

/net/gnu-13/export/gnu/src/gcc/gcc/gcc/final.c: In function `get_attr_length':
/net/gnu-13/export/gnu/src/gcc/gcc/gcc/final.c:454: error: `insn_default_length'
undeclared (first use in this function)
/net/gnu-13/export/gnu/src/gcc/gcc/gcc/final.c:454: error: (Each undeclared
identifier is reported only once
/net/gnu-13/export/gnu/src/gcc/gcc/gcc/final.c:454: error: for each function it
appears in.)
/net/gnu-13/export/gnu/src/gcc/gcc/gcc/final.c: In function `get_attr_min_length':
/net/gnu-13/export/gnu/src/gcc/gcc/gcc/final.c:462: error: `insn_min_length'
undeclared (first use in this function)
Comment 1 Andrew Pinski 2005-09-21 11:28:43 UTC
Confirmed, it is kinda of interesting that IA64 is one of the few targets which does not have the length 
attr (or have HAVE_ATTR_length defined).

The easy fix is the following:
int
get_attr_length (rtx insn)
{
#ifdef HAVE_ATTR_length
  return get_attr_length_1 (insn, insn_default_length);
#else
  return get_attr_length_1 (insn, 0);
#endif
}
Comment 2 joern.rennecke@st.com 2005-09-21 14:07:59 UTC
Subject: Re:  [4.1 Regression]: Gcc failed to build on ia64

pinskia at gcc dot gnu dot org wrote:

>------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-21 11:28 -------
>Confirmed, it is kinda of interesting that IA64 is one of the few targets which does not have the length 
>attr (or have HAVE_ATTR_length defined).
>
>The easy fix is the following:
>int
>get_attr_length (rtx insn)
>{
>#ifdef HAVE_ATTR_length
>  return get_attr_length_1 (insn, insn_default_length);
>#else
>  return get_attr_length_1 (insn, 0);
>#endif
>}
>
>  
>
We have to cover both get_attr_length and get_attr_min_length.
I think the attached patch is a cleaner solution.
2005-09-21  J"orn Rennecke <joern.rennecke@st.com>

	* final.c (get_attr_length_1): In !HAVE_ATTR_length case, define as
	macro.  Don't attach ATTRIBUTE_UNUSED to arguments.
	(get_attr_length, get_attr_min_length): Add ATTRIBUTE_UNUSED.

--- final.c	2005-09-20 22:41:08.000000000 +0100
+++ final.c-fixed	2005-09-21 14:58:05.000000000 +0100
@@ -385,11 +385,10 @@ init_insn_lengths (void)
 /* Obtain the current length of an insn.  If branch shortening has been done,
    get its actual length.  Otherwise, use FALLBACK_FN to calcualte the
    length.  */
+#ifdef HAVE_ATTR_length
 static inline int
-get_attr_length_1 (rtx insn ATTRIBUTE_UNUSED,
-		   int (*fallback_fn) (rtx) ATTRIBUTE_UNUSED)
+get_attr_length_1 (rtx insn, int (*fallback_fn) (rtx))
 {
-#ifdef HAVE_ATTR_length
   rtx body;
   int i;
   int length = 0;
@@ -441,15 +440,15 @@ get_attr_length_1 (rtx insn ATTRIBUTE_UN
   ADJUST_INSN_LENGTH (insn, length);
 #endif
   return length;
+}
 #else /* not HAVE_ATTR_length */
-  return 0;
+#define get_attr_length_1(insn,fallback_fn) 0
 #endif /* not HAVE_ATTR_length */
-}
 
 /* Obtain the current length of an insn.  If branch shortening has been done,
    get its actual length.  Otherwise, get its maximum length.  */
 int
-get_attr_length (rtx insn)
+get_attr_length (rtx insn ATTRIBUTE_UNUSED)
 {
   return get_attr_length_1 (insn, insn_default_length);
 }
@@ -457,7 +456,7 @@ get_attr_length (rtx insn)
 /* Obtain the current length of an insn.  If branch shortening has been done,
    get its actual length.  Otherwise, get its minimum length.  */
 int
-get_attr_min_length (rtx insn)
+get_attr_min_length (rtx insn ATTRIBUTE_UNUSED)
 {
   return get_attr_length_1 (insn, insn_min_length);
 }
Comment 3 Ian Lance Taylor 2005-09-21 19:21:35 UTC
Subject: Re:  [4.1 Regression]: Gcc failed to build on ia64

Joern RENNECKE <joern.rennecke@st.com> writes:

> 2005-09-21  J"orn Rennecke <joern.rennecke@st.com>
> 
> 	* final.c (get_attr_length_1): In !HAVE_ATTR_length case, define as
> 	macro.  Don't attach ATTRIBUTE_UNUSED to arguments.
> 	(get_attr_length, get_attr_min_length): Add ATTRIBUTE_UNUSED.

Ick, don't do that.  Suppose you just #define insn_default_length and
insn_min_length as macros ifndef HAVE_ATTR_length.

Ian
Comment 4 Andrew Pinski 2005-09-21 19:24:40 UTC
Subject: Re:  [4.1 Regression]: Gcc failed to build on ia64


On Sep 21, 2005, at 3:20 PM, Ian Lance Taylor wrote:

> Joern RENNECKE <joern.rennecke@st.com> writes:
>
>> 2005-09-21  J"orn Rennecke <joern.rennecke@st.com>
>>
>> 	* final.c (get_attr_length_1): In !HAVE_ATTR_length case, define as
>> 	macro.  Don't attach ATTRIBUTE_UNUSED to arguments.
>> 	(get_attr_length, get_attr_min_length): Add ATTRIBUTE_UNUSED.
>
> Ick, don't do that.  Suppose you just #define insn_default_length and
> insn_min_length as macros ifndef HAVE_ATTR_length.


Of course both insn_default_length and insn_min_length are used as 
functions
in this situation.

Thanks,
Andrew Pinski

Comment 5 Ian Lance Taylor 2005-09-21 19:30:42 UTC
Subject: Re:  [4.1 Regression]: Gcc failed to build on ia64

Andrew Pinski <pinskia@physics.uc.edu> writes:

> On Sep 21, 2005, at 3:20 PM, Ian Lance Taylor wrote:
> 
> > Joern RENNECKE <joern.rennecke@st.com> writes:
> >
> >> 2005-09-21  J"orn Rennecke <joern.rennecke@st.com>
> >>
> >> 	* final.c (get_attr_length_1): In !HAVE_ATTR_length case, define as
> >> 	macro.  Don't attach ATTRIBUTE_UNUSED to arguments.
> >> 	(get_attr_length, get_attr_min_length): Add ATTRIBUTE_UNUSED.
> >
> > Ick, don't do that.  Suppose you just #define insn_default_length and
> > insn_min_length as macros ifndef HAVE_ATTR_length.
> 
> 
> Of course both insn_default_length and insn_min_length are used as
> functions
> in this situation.

Hmmm, right.  Bother.  Still doable, but uglier.

Ian
Comment 6 joern.rennecke@st.com 2005-09-22 17:14:38 UTC
Subject: Re:  [4.1 Regression]: Gcc failed to build on ia64

Ian Lance Taylor wrote:

>>2005-09-21  J"orn Rennecke <joern.rennecke@st.com>
>>
>>	* final.c (get_attr_length_1): In !HAVE_ATTR_length case, define as
>>	macro.  Don't attach ATTRIBUTE_UNUSED to arguments.
>>	(get_attr_length, get_attr_min_length): Add ATTRIBUTE_UNUSED.
>>    
>>
>
>Ick, don't do that.  Suppose you just #define insn_default_length and
>insn_min_length as macros ifndef HAVE_ATTR_length.
>
>Ian
>  
>
Do you like the attached patch better?


2005-09-22  J"orn Rennecke <joern.rennecke@st.com>

	* final.c (insn_default_length, insn_min_length): In !HAVE_ATTR_length
	case, define as macros.

Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.361
diff -p -r1.361 final.c
*** final.c	20 Sep 2005 21:48:36 -0000	1.361
--- final.c	22 Sep 2005 17:10:14 -0000
*************** get_attr_length_1 (rtx insn ATTRIBUTE_UN
*** 443,448 ****
--- 443,450 ----
    return length;
  #else /* not HAVE_ATTR_length */
    return 0;
+ #define insn_default_length 0
+ #define insn_min_length 0
  #endif /* not HAVE_ATTR_length */
  }
  
Comment 7 Ian Lance Taylor 2005-09-22 19:23:33 UTC
Subject: Re:  [4.1 Regression]: Gcc failed to build on ia64

Joern RENNECKE <joern.rennecke@st.com> writes:

> 2005-09-22  J"orn Rennecke <joern.rennecke@st.com>
> 
> 	* final.c (insn_default_length, insn_min_length): In !HAVE_ATTR_length
> 	case, define as macros.

I do like it better.  This patch is approved after testing.

Thanks.

Ian
Comment 8 GCC Commits 2005-09-23 12:15:52 UTC
Subject: Bug 23991

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amylaar@gcc.gnu.org	2005-09-23 12:15:43

Modified files:
	gcc            : ChangeLog 

Log message:
	Add PR number in this entry:
	PR middle-end/23991
	* final.c (insn_default_length, insn_min_length): In !HAVE_ATTR_length
	case, define as macros.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10009&r2=2.10010

Comment 9 Andrew Pinski 2005-09-23 12:50:54 UTC
Fixed.