Creating a patch ready for gcc-patches list

2007-06-06 Thread Brian Sidebotham

Hi,

I am building a cross-compiler for arm, which builds "okay", but the 
output is very noisy whilst compiling gcc. I'd like to sort some of it 
out and submit some patches, but I've not done any patches for gcc 
before so I don't want to create a lot of noise on the gcc-patches list 
by posting up patches that are not considered correctly formatted, etc.


At the end of this message is a patch to remove a 'variable might be 
used uninitialised' warning which is thrown up whilst bootstrapping gcc.


Is this patch okay to submit to the gcc-patches list?

I haven't touched the ChangeLog, should I fill it in?

Best Regards,

Brian Sidebotham.

--- ./gcc/value-prof.c  Mon Jun  4 17:27:14 2007
+++ ./gcc/value-prof.c  Wed Jun  6 10:13:20 2007

@@ -883,15 +883,19 @@ tree_mod_subtract (tree stmt, tree opera
   e12 = split_block (bb, bb1end);
   bb2 = e12->dest;
   bb2->count = all - count1;
-
+
   if (ncounts) /* Assumed to be 0 or 1.  */
 {
   e23 = split_block (bb2, bb2end);
   bb3 = e23->dest;
   bb3->count = all - count1 - count2;
+  e34 = split_block (bb3 : bb2, bb3end);
+}
+  else
+{
+  e34 = split_block (bb2, bb3end);
 }

-  e34 = split_block (ncounts ? bb3 : bb2, bb3end);
   bb4 = e34->dest;
   bb4->count = all;



Re: Creating a patch ready for gcc-patches list

2007-06-06 Thread Brian Sidebotham

Hi,

Sorry, wasted your time already!! Thanks to Manuel for the information too.

I will re-patch, compile and run the testsuite. Sorry to waste your time 
with my first mail!


Best Regards,

Brian Sidebotham.

Jan-Benedict Glaw wrote:

On Wed, 2007-06-06 10:15:41 -0700, Brian Sidebotham <[EMAIL PROTECTED]> wrote:

--- ./gcc/value-prof.c  Mon Jun  4 17:27:14 2007
+++ ./gcc/value-prof.c  Wed Jun  6 10:13:20 2007

@@ -883,15 +883,19 @@ tree_mod_subtract (tree stmt, tree opera
   e12 = split_block (bb, bb1end);
   bb2 = e12->dest;
   bb2->count = all - count1;
-
+
   if (ncounts) /* Assumed to be 0 or 1.  */
 {
   e23 = split_block (bb2, bb2end);
   bb3 = e23->dest;
   bb3->count = all - count1 - count2;
+  e34 = split_block (bb3 : bb2, bb3end);

   `-'

First of all, you should compile GCC with your patch applied, and then
run the testsuite. No new regressions should occur (or you should have
a good reason for them!)


+}
+  else
+{
+  e34 = split_block (bb2, bb3end);
 }

-  e34 = split_block (ncounts ? bb3 : bb2, bb3end);
   bb4 = e34->dest;
   bb4->count = all;


However, this won't even compile, so please redo it, compile it, test
it with the regression suite and submit it with a ChangeLog entry.
(Just plain text, don't prepare it as a patch to the ChangeLog file!)

MfG, JBG



[mingw] arm-elf-gcc build error with fixincludes file error

2007-06-07 Thread Brian Sidebotham

Hi,

I am compiling arm-elf-gcc using mingw on Windows XP through msys, and 
although the C compiler compiles there is output near the end, which 
includes a file error for fixincludes. The file doesn't exist after the 
build.


...
sed: Couldn't open file C:\Temp\fxinc2;
FS error 2 (No such file or directory) reopening 'math.h' as stdin
sed: -e expression #10, char 39: Unterminated `s' command
sed: read error on {standard input}: Bad file number
Applying sun_malloc   to malloc.h
Applying broken_cabs  to math.h
Applying sysv68_stringto string.h
Applying stdio_va_list_clientsto wchar.h

...

When I try and run the compiler tests with make -k check I get the 
following output:


...
$ make -k check
make[1]: Entering directory `/mingw/src/build-gcc'
make[2]: Entering directory `/mingw/src/build-gcc/fixincludes'
autogen -T ../../gcc-4.1-20070604/fixincludes/check.tpl 
../../gcc-4.1-20070604/fixincludes/inclhack.def

/bin/sh ./check.sh ../../gcc-4.1-20070604/fixincludes/tests/base
FS error 2 (No such file or directory) reopening 'testing.h' as stdin
sed: -e expression #10, char 39: Unterminated `s' command
FS error 2 (No such file or directory) reopening 'testing.h' as stdin
sed: -e expression #10, char 39: Unterminated `s' command
FS error 2 (No such file or directory) reopening 'AvailabilityMacros.h' 
as stdin

FS error 2 (No such file or directory) reopening 'X11/ShellP.h' as stdin
FS error 2 (No such file or directory) reopening 'X11/Xmu.h' as stdin
...

So I can't test the patch that I was previously enquiring about. The 
trouble is, I cannot find any reference to sed commands which are 
generating the errors - I just don't know where to start looking for 
clues. Can anyone suggest where to start looking?


Make -k check finally exits with:

...
/bin/sh: runtest: command not found
make[2]: [check-gcc] Error 127 (ignored)
make[2]: Leaving directory `/mingw/src/build-gcc/gcc'
make[2]: Entering directory `/mingw/src/build-gcc/intl'
make[2]: Nothing to be done for `check'.
make[2]: Leaving directory `/mingw/src/build-gcc/intl'
make[2]: Entering directory `/mingw/src/build-gcc/libcpp'
make[2]: Nothing to be done for `check'.
make[2]: Leaving directory `/mingw/src/build-gcc/libcpp'
make[2]: Entering directory `/mingw/src/build-gcc/libiberty'
make[3]: Entering directory `/mingw/src/build-gcc/libiberty/testsuite'
./test-demangle < 
../../../gcc-4.1-20070604/libiberty/testsuite/demangle-expected
c:\msys\1.0\mingw\src\build-gcc\libiberty\testsuite\test-demangle.exe: 
748 tests, 0 failures

./test-pexecute
make[3]: Leaving directory `/mingw/src/build-gcc/libiberty/testsuite'
make[2]: Leaving directory `/mingw/src/build-gcc/libiberty'
make[1]: Target `check-host' not remade because of errors.
make[1]: Nothing to be done for `check-target'.
make[1]: Leaving directory `/mingw/src/build-gcc'
make: *** [do-check] Error 2
make: Target `check' not remade because of errors.
...

Any pointers are much appreciated!

Best Regards,

Brian Sidebotham.


bootstrap failure while compiling gcc/tree.c

2007-08-23 Thread Brian Sidebotham

../../gcc/gcc/tree.c: In function "build_string":
../../gcc/gcc/tree.c:1197: internal compiler error: in iterative_hash_expr, at 
tree.c:4189

Please submit a full bug report,
with preprocessed source if appropriate.

I have placed the pre-processed file here:
http://www.valvers.com/gcc/arm-elf/tree.i (1.5Mb)

The following configure line was used:

../gcc/configure --target=arm-elf --prefix=${installdir} --with-newlib 
--with-headers=${newlibdir}/src/newlib/libc/include --enable-languages=c,c++ 
--enable-interwork --enable-multilib


codebase is svn revision 127732

The failing command line is:

gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition 
-Wmissing-format-attribute -fno-common   -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc 
-I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include 
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd 
-I../libdecnumber../../gcc/gcc/tree.c -o tree.o


and lastly, the specs of the gcc compiler being used are:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr 
--disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu

Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)

Best Regards,

Brian Sidebotham.



Re: bootstrap failure while compiling gcc/tree.c

2007-08-23 Thread Brian Sidebotham

Brian Sidebotham wrote:

../../gcc/gcc/tree.c: In function "build_string":
../../gcc/gcc/tree.c:1197: internal compiler error: in 
iterative_hash_expr, at tree.c:4189

Please submit a full bug report,
with preprocessed source if appropriate.

I have placed the pre-processed file here:
http://www.valvers.com/gcc/arm-elf/tree.i (1.5Mb)

The following configure line was used:

../gcc/configure --target=arm-elf --prefix=${installdir} --with-newlib 
--with-headers=${newlibdir}/src/newlib/libc/include 
--enable-languages=c,c++ --enable-interwork --enable-multilib


codebase is svn revision 127732

The failing command line is:

gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall 
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wold-style-definition -Wmissing-format-attribute -fno-common   
-DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. 
-I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include 
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd 
-I../libdecnumber../../gcc/gcc/tree.c -o tree.o


and lastly, the specs of the gcc compiler being used are:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-java-awt=gtk-default 
--enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre 
--enable-mpfr --disable-werror --with-tune=pentium4 
--enable-checking=release i486-linux-gnu

Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)



These are the two lines that fail:

tree.c:1197: memcpy (CONST_CAST (TREE_STRING_POINTER (s)), str, len);
  memcpy (((__extension__(union {__typeof(((const char *)(STRING_CST_CHECK 
(s)->string.str)))_q; void *_v;})(((const char *)(STRING_CST_CHECK 
(s)->string.str._v), str, len);


tree.c:1198: ((char *) CONST_CAST (TREE_STRING_POINTER (s)))[len] = '\0';
  ((char *) ((__extension__(union {__typeof(((const char *)(STRING_CST_CHECK 
(s)->string.str)))_q; void *_v;})(((const char *)(STRING_CST_CHECK 
(s)->string.str._v))[len] = '\0';


Removing the CONST_CAST delcarlations allows compilation of gcc to complete with 
a warning (as expected)


../../gcc/gcc/tree.c: In function 'build_string':
../../gcc/gcc/tree.c:1197: warning: passing argument 1 of âmemcpyâ discards 
qualifiers from pointer target type


Best Regards,

Brian Sidebotham.


Re: bootstrap failure while compiling gcc/tree.c (ICE)

2007-08-24 Thread Brian Sidebotham

Brian Sidebotham wrote:

Brian Sidebotham wrote:

../../gcc/gcc/tree.c: In function "build_string":
../../gcc/gcc/tree.c:1197: internal compiler error: in 
iterative_hash_expr, at tree.c:4189

Please submit a full bug report,
with preprocessed source if appropriate.

I have placed the pre-processed file here:
http://www.valvers.com/gcc/arm-elf/tree.i (1.5Mb)

The following configure line was used:

../gcc/configure --target=arm-elf --prefix=${installdir} --with-newlib 
--with-headers=${newlibdir}/src/newlib/libc/include 
--enable-languages=c,c++ --enable-interwork --enable-multilib


codebase is svn revision 127732

The failing command line is:

gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall 
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wold-style-definition -Wmissing-format-attribute -fno-common   
-DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. 
-I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include 
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd 
-I../libdecnumber../../gcc/gcc/tree.c -o tree.o


and lastly, the specs of the gcc compiler being used are:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-java-awt=gtk-default 
--enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre 
--enable-mpfr --disable-werror --with-tune=pentium4 
--enable-checking=release i486-linux-gnu

Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)



These are the two lines that fail:

tree.c:1197: memcpy (CONST_CAST (TREE_STRING_POINTER (s)), str, len);
  memcpy (((__extension__(union {__typeof(((const char 
*)(STRING_CST_CHECK (s)->string.str)))_q; void *_v;})(((const char 
*)(STRING_CST_CHECK (s)->string.str._v), str, len);


tree.c:1198: ((char *) CONST_CAST (TREE_STRING_POINTER (s)))[len] = '\0';
  ((char *) ((__extension__(union {__typeof(((const char 
*)(STRING_CST_CHECK (s)->string.str)))_q; void *_v;})(((const char 
*)(STRING_CST_CHECK (s)->string.str._v))[len] = '\0';


Removing the CONST_CAST delcarlations allows compilation of gcc to 
complete with a warning (as expected)


../../gcc/gcc/tree.c: In function 'build_string':
../../gcc/gcc/tree.c:1197: warning: passing argument 1 of âmemcpyâ 
discards qualifiers from pointer target type



This ICE is caused by the following patch:

2007-08-10  Kaveh R. Ghazi  <[EMAIL PROTECTED]>

* system.h (CONST_CAST): New.
* c-decl.c (c_make_fname_decl): Use it.
* c-lex.c (cb_ident, lex_string): Likewise.
* c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
* gcc.c (set_spec, read_specs, for_each_path, execute, do_spec_1,
give_switch, set_multilib_dir): Likewise.
* gengtype-parse.c (string_seq, typedef_name): Likewise.
* passes.c (execute_one_pass): Likewise.
* prefix.c (update_path): Likewise.
* pretty-print.c (pp_base_destroy_prefix): Likewise.
* tree.c (build_string): Likewise.

Reverting this patch lets gcc build again.

Unfortunately, CONST_CAST is a mystery to me (I don't understand it!) so there 
is no hope of me changing it to compile okay AND be right!


Best Regards,

Brian Sidebotham.


Re: bootstrap failure while compiling gcc/tree.c (ICE)

2007-08-28 Thread Brian Sidebotham

Kaveh R. GHAZI wrote:

On Fri, 24 Aug 2007, Brian Sidebotham wrote:


This ICE is caused by the following patch:

2007-08-10  Kaveh R. Ghazi  <[EMAIL PROTECTED]>

* system.h (CONST_CAST): New.
* c-decl.c (c_make_fname_decl): Use it.
* c-lex.c (cb_ident, lex_string): Likewise.
* c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
* gcc.c (set_spec, read_specs, for_each_path, execute, do_spec_1,
give_switch, set_multilib_dir): Likewise.
* gengtype-parse.c (string_seq, typedef_name): Likewise.
* passes.c (execute_one_pass): Likewise.
* prefix.c (update_path): Likewise.
* pretty-print.c (pp_base_destroy_prefix): Likewise.
* tree.c (build_string): Likewise.


2007-08-26  Kaveh R. Ghazi  <[EMAIL PROTECTED]>

* system.h (CONST_CAST): Avoid union for gcc-4.0.x.

diff -rup orig/egcc-SVN20070825/gcc/system.h egcc-SVN20070825/gcc/system.h
--- orig/egcc-SVN20070825/gcc/system.h  2007-08-10 14:11:38.0 -0400
+++ egcc-SVN20070825/gcc/system.h   2007-08-26 12:29:12.577795974 -0400
@@ -774,7 +774,9 @@ extern void fancy_abort (const char *, i
execv, et al.  Another valid use would be in an allocation function
that creates const objects that need to be initialized.  Most other
cases should be viewed with extreme caution.  */
-#ifdef __GNUC__
+
+#if defined(__GNUC__) && GCC_VERSION != 4000
+/* GCC 4.0.x has a bug where it may ICE on this expression.  */
 #define CONST_CAST(X) ((__extension__(union {__typeof(X)_q; void *_v;})(X))._v)
 #else
 #define CONST_CAST(X) ((void*)(X))



Hi Kaveh,

This patch solves the issue, thanks!

Best Regards,

Brian Sidebotham.