Re: [Fink-devel] Re: Bug in as from Dec2002gccUpdater.pkg

2003-07-27 Thread Martin Costabel
Andrew Pinski wrote:
Just to keep you guys up to date on this problem, this is fixed in the 
FSF's CVS version of gcc
by: http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02565.html.
Thanks for the information. Since this patch does not apply directly to 
the gcc-3.3 sources, I changed it somewhat so that it does (I also 
removed some hot air from the original patch). With this patch, Fink's 
g77-3.3-2 package produces a g77 compiler that seems to agree with 
Apples's new assembler. I have not tested it extensively, but at least 
the couple of fortran programs where this bug was detected are compiling 
corectly now.

I am not sure if this modified patch for gcc-3.3 is a valid backport of 
 Geoff Keating's patch for gcc-cvs, but if no one objects, this patch 
would be a simple solution for the g77/as problem, at least for Fink.

Apple would still have to release updates for their gcc-2.95-2, gcc-3.1, 
and  gcc-3.3. They are claiming now, after all, that their compilers 
always produced erroneous code. So they should fix them.

Here is the modified patch. I also put a copy into my experimental 
directory on fink cvs.

File: g77-3.3-2.patch

--- g77-3.3-2/gcc-3.3/gcc/varasm.c~ Sun Jul 27 15:10:00 2003
+++ g77-3.3-2/gcc-3.3/gcc/varasm.c  Sun Jul 27 15:11:52 2003
@@ -2825,6 +2825,8 @@
  int labelno;
 {
   int align;
+  HOST_WIDE_INT size;
+  char label[256];
   /* Align the location counter as required by EXP's data type.  */
   align = TYPE_ALIGN (TREE_TYPE (exp));
@@ -2843,16 +2845,23 @@
 }
   /* Output the label itself.  */
+  size = int_size_in_bytes (TREE_TYPE (exp));
+  if (TREE_CODE (exp) == STRING_CST)
+size = MAX (TREE_STRING_LENGTH (exp), size);
+
+  /* Do any machine/system dependent processing of the constant.  */
+#ifdef ASM_DECLARE_CONSTANT_NAME
+  /* Create a string containing the label name, in LABEL.  */
+  ASM_GENERATE_INTERNAL_LABEL (label, LC, labelno);
+  ASM_DECLARE_CONSTANT_NAME (asm_out_file, label, exp, size);
+#else
+  /* Standard thing is just output label for the constant.  */
   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, LC, labelno);
+#endif /* ASM_DECLARE_CONSTANT_NAME */
-  /* Output the value of EXP.  */
-  output_constant (exp,
-  (TREE_CODE (exp) == STRING_CST
-   ? MAX (TREE_STRING_LENGTH (exp),
-  int_size_in_bytes (TREE_TYPE (exp)))
-   : int_size_in_bytes (TREE_TYPE (exp))),
-  align);
+  /* Output the value of EXP.  */
+  output_constant (exp, size, align);
 }
 ^L
 /* Used in the hash tables to avoid outputting the same constant
--- g77-3.3-2/gcc-3.3/gcc/config/darwin.h~  Fri Dec 20 02:49:57 2002
+++ g77-3.3-2/gcc-3.3/gcc/config/darwin.h   Sun Jul 27 15:04:01 2003
@@ -380,6 +380,10 @@
 || DECL_INITIAL (DECL)) \
   (* targetm.encode_section_info) (DECL, false);   \
 ASM_OUTPUT_LABEL (FILE, xname); \
+/* Darwin doesn't support zero-size objects, so give them a\
+   byte.  */   \
+if (tree_low_cst (DECL_SIZE_UNIT (DECL), 1) == 0)  \
+  assemble_zeros (1);  \
   } while (0)
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
@@ -400,6 +404,15 @@
outputting any required stub name label now.  */
\
 machopic_output_possible_stub_label (FILE, xname); \
   } while (0)
+
+#define ASM_DECLARE_CONSTANT_NAME(FILE, NAME, EXP, SIZE)   \
+  do { \
+ASM_OUTPUT_LABEL (FILE, NAME); \
+/* Darwin doesn't support zero-size objects, so give them a\
+   byte.  */   \
+if ((SIZE) == 0)   \
+  assemble_zeros (1);  \
+   } while (0)
 /* Wrap new method names in quotes so the assembler doesn't gag.
Make Objective-C internal symbols local.  */
--
Martin


---
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01
___
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel


Re: [Fink-devel] Re: Bug in as from Dec2002gccUpdater.pkg

2003-07-01 Thread Andrew Pinski
A workaround is to use -mdynamic-no-pic (that even speeds up your 
programs).
Note -mdynamic-no-pic should not be used with shared libraries, also it 
is not
in the FSF's gcc until 3.4 (aka it is in the cvs).
I have filed a bug with the FSF, http://gcc.gnu.org/PR11387  because I 
still think this is a gcc bug
(and not an apple specific one, I can reproduce it with the mainline of 
the FSF's gcc) and not an as bug either.

Thanks,
Andrew Pinski
On Tuesday, Jul 1, 2003, at 08:27 US/Eastern, Max Horn wrote:

Am Dienstag, 01.07.03 um 10:04 Uhr schrieb Martin Costabel:

Andrew Pinski wrote:

OK, I hunted it down. It is really too silly: The code produced by 
a fortran STOP statement (without optional stop-code) is treated as 
an error by the new assembler. Definitely a bug in as.
No because gcc should produce something at that symbol but it is 
not, so the bug still is in gcc, not as.
Actually, the situation is worse: g77 is doing this in many other 
situations. The simple Hello World program

 PRINT*,'Hello World'
 END
produces this error, and even the minimal program

	 END

does it. All versions of g77 I could get my hands on produce a label 
without data in this case. No other assembler than the new Apple one 
considers this an error.

What are the chances that we will see a fix of this bug in gcc-3.3 so 
that we will be able to use g77 again with Apple's new assembler?

From what you are saying and given Apple's repeatedly demonstrated 
lack of interest in g77, I fear that the user will be left out in the 
cold on this.

Lack of interest? Just because they don't ship it doesn't mean they 
lack interest in it. I think Apple is well aware that a noticable 
share of its users are coming from science, and Fortran (that includes 
G77) is vital there.Don't give up to early. File bug reports with 
Apple's bug reporter, and get everybody else to file the bug, too 
(yeah this time I am advocating multiple bug reports. If many people 
complain, maybe they notice that it's not just an oddball weirdo user 
experiencing the problem).

My real concern here isn't whether they'll fix it; rather, *if* they 
fix it: maybe you have to wait again half a year before they release a 
dev tools bug fix update *grmbl*.

Max





---
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa0016ave/direct;at.asp_061203_01/01
___
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel


Re: [Fink-devel] Re: Bug in as from Dec2002gccUpdater.pkg

2003-07-01 Thread Martin Costabel
Andrew Pinski wrote:

A workaround is to use -mdynamic-no-pic (that even speeds up your 
programs).
Note -mdynamic-no-pic should not be used with shared libraries, also it 
is not
in the FSF's gcc until 3.4 (aka it is in the cvs).
So this is not a usable workaround right now. Fink will have to do 
something about this right now (darwinports will have to do something 
similar; AFAIK they have a g77 package and probably other packages that 
use g77, too; maybe we should discuss this on the metapkg list?). The 
only possibility I see is to put up a warning:

If you want to use g77 or install packages that use g77 (some list, 
scilab, atlas, octave, pgplot,... goes here), *do not install* Apple's 
Dec2002gccUpdater.pkg from the Apple developer web site.

If you want to install it nevertheless, make sure you backup the file 
/usr/libexec/gcc/darwin/ppc/as from your Dec2002 dev tools first and 
then after the installation of the Updater, replace the new version of 
this file by the old one.

If you already installed the Updater, get the Dec 2002 version of 
/usr/libexec/gcc/darwin/ppc/as by extracting it from your Dec2002 dev 
tools disk image (lengthy description on how to use pax to do this 
follows here), or get a copy of it from the web here (URL of a copy on a 
fink mirror follows here).

If you have a G5 and want to use g77, you are screwed until a bug fix 
from Apple shows up.

--
Martin


---
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa0016ave/direct;at.asp_061203_01/01
___
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel