Switch statement optimization

2006-07-10 Thread Christian Hildner

Hi,

while dealing with autogenerated code I found that GCC often outputs compare 
trees instead of branch tables for switch statements. I found that GCC uses the 
density of case labels within their spanned range as the key criterion. If the 
density of labels is smaller than 10% (33% for size optimization) then GCC uses 
compare instruction rather than a branch table. What I am wondering is why no 
real cost estimation is done here. In my case there are around 200 to 1500 
labels within the 16K range, so they are completely resolved to compares. In 
contrast the Intel compiler outputs branch tables more likely.

The question now is whether the factors 10 (3 for size opt) have been found 
using any standard benchmark. And shouldn't at least the factor be optimized 
for a standard benchmark (like the upcoming SPEC CPU 2006 INT) if this simple 
linear method is used for modeling a logarithmic behavior? Or should a cost 
estimation be introduced?

For size optimization there could be a quite accurate architecture dependent 
size estimation.

Opinions, Comments?

Christian

PS: Please CC me.




Re: Switch statement optimization

2006-07-10 Thread Ben Elliston
A paper at this year's GCC Summit talked about this:

  http://www.gccsummit.org/2006/view_abstract.php?content_key=18

You might like to follow up with Edmar (the author of the paper).

Cheers, Ben


Questions regarding __register_frame_info

2006-07-10 Thread jacob navia

Hi

I have now everything in place for dynamically register the
debug frame information that my JIT (Just in time compiler)
generates.

I generate a CIE (Common information block), followed by
a series of FDE (Frame Description Entries) describing
each stack frame. The binary code is the same as gcc uses,
the contents of my stuff are identical to the contents of
the .eh_frame information.

There are several of those functions defined in unwind-dw2-fde.c:

__register_frame_info
__register_frame_info_bases
__register_frame_info_table_bases

If I use the
__register_frame_info
stuff, nothing happens and the program aborts.
Using __register_frame_jnfo_table_bases seems to
work better since it crashes a little bit further with a
hard crash.

Questions:

What is the procedure for registering the frame info?
I use following:

   memset(&ob,0,sizeof(ob));
   ob.pc_begin = (void *)-1;
   ob.tbase = Parms.codebuf; // Machine instructions
   ob.dbase = Parms.codebuf+myLccParms.text_size; // data of the 
program

   ob.s.i = 0;
   ob.s.b.encoding = 0xff; //DW_EH_PE_omit;
   
__register_frame_info_table_bases(Parms.pUnwindTables,&ob,ob.tbase,ob.dbase);


"ob" is an object defined as follows:

struct object {
 void *pc_begin;
  void *tbase;
  void *dbase;
  union {
   const struct dwarf_fde *single;
  struct dwarf_fde **array;
   struct fde_vector *sort;
 } u;

union {
struct {
  unsigned long sorted : 1;
 unsigned long from_array : 1;
   unsigned long mixed_encoding : 1;
 unsigned long encoding : 8;
unsigned long count : 21;
} b;
size_t i;
   } s;
#ifdef DWARF2_OBJECT_END_PTR_EXTENSION
   char *fde_end;
#endif
struct object *next;
};

From the code of register_frame_info (in file unwind-dw2-fde.c)
that function just inserts the new data into a linked list, but it
does not do anything more. That is why probably it will never
work.

Could someone here explain me or tell me what to do exactly to register
the frame information?

This will be useful for all people that write JITs, for instance the 
Java people,

and many others.

Thanks in advance for your help, and thanks for the help this group
has provided me already

jacob




Re: Switch statement optimization

2006-07-10 Thread Joern RENNECKE

In http://gcc.gnu.org/ml/gcc/2006-07/msg00156.html, your wrote:


A paper at this year's GCC Summit talked about this:
  http://www.gccsummit.org/2006/view_abstract.php?content_key=18
You might like to follow up with Edmar (the author of the paper).


But that was about optimizing the trees for an uneven probability distribution 
which could be found by profiling.
This does not address the issue what to do when the distribution is mostly 
uniform or unknown.

We could use a cheap hash and base start compare / branch trees in every hash 
bin.
Say we have a 16 k range, 200 nodes, and want to keep the hash bin/node ratio 
between 2 and 4.
Let i be the switch argument.  Then we can calculate a 9 bit hash as
(i ^ (x << n)) & 0x3fff, where n is a value between 5 and 9.  We can pick 
the one which produces the flattest
average search trees.
Note that we no longer need to check that i is in range, as for ordinary switch 
dispatch tables.

Moreover, on a target that can do effectively multi-way compares like the x86, 
in order
to increase ILP, we can put into the table entry for each hash bin, in addition 
to the
jump address, a value to compare i against before the dispatch jump takes place.
If a cheap hash can be chosen so that there is no more than one entry per hash 
bin, we
can even do a single compare in the dispatch code, go to the default case for 
non-match,
and dispatch right to the handling code if we have a match.




Re: externs and thread local storage

2006-07-10 Thread Richard Henderson
On Fri, Jul 07, 2006 at 10:56:08PM -0400, Robert Dewar wrote:
> That's not true, thread local storage can be done simply by mapping
> hardware on some machines, where you swap maps on a context switch.

Not with the semantics we have for __thread, which asserts
that its address is valid in all threads.

And, no one has tried this since Irix, wherein it didn't 
perform well.  the effects of tlb flushing at context
switch are heavy.


r~


Re: request for new a syntactic design for C/C++.

2006-07-10 Thread Ian Lance Taylor
"Vladimir 'Yu' Stepanov" <[EMAIL PROTECTED]> writes:

> Current syntax C/C++:
> 
>   load_ptr = typeof(load_ptr)(((char *)init_ptr) - \
>offsetof(typeof(init_ptr), field);
> 
> The offered syntax:
> 
>   &load_ptr->field = init_ptr;

Interesting idea, but C/C++ programmers expect that an assignment sets
the entire expression on the left of the '='.  So I don't think this
is a good syntax.

In fact you can already write what you want with a macro, one quite
similar to offsetof, so I don't think we need any new syntactic sugar
here.

> C++:
>   struct some_struct &link = other;

This already means something in C++: it means to create a reference.

Ian


Re: Questions regarding __register_frame_info

2006-07-10 Thread Mike Stump

On Jul 10, 2006, at 6:57 AM, jacob navia wrote:

What is the procedure for registering the frame info?


If you don't get an answer, you may have to debug it.  Just follow  
what something like eh6.C from the C++ testsuite does, and what it  
calls, when, and with what data, then mirror the eh6.C code in your  
language, JIT it, load it and then run it side by side with eh6.C and  
see if it behaves the same, or differently, and why.  Be sure to use  
si/ni and display/1i $pc to see what is going on, if doing it by  
source lines doesn't reveal what is going on.


Mainline build broken (was: r115310 - in /trunk: fixincludes/ChangeLog fixi...)

2006-07-10 Thread Jan-Benedict Glaw
On Mon, 2006-07-10 17:58:19 -, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Author: lauras
> Date: Mon Jul 10 17:58:18 2006
> New Revision: 115310
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115310
> Log:
> fixincludes:
> 2006-07-10  Laurynas Biveinis  <[EMAIL PROTECTED]>
> 
>   PR bootstrap/20437
>   * Makefile.in (configure, config.h.in): change into $(srcdir)
>   before autoconf or autoheader call.

This patch broke building GCC because Makefile indention was done with
spaces instead of a TAB.

MfG, JBG

-- 
Jan-Benedict Glaw   [EMAIL PROTECTED]. +49-172-7608481 _ O _
"Eine Freie Meinung in  einem Freien Kopf| Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));


signature.asc
Description: Digital signature


Re: Mainline build broken (was: r115310 - in /trunk: fixincludes/ChangeLog fixi...)

2006-07-10 Thread Laurynas Biveinis

Will fix right now.

2006/7/10, Jan-Benedict Glaw <[EMAIL PROTECTED]>:

On Mon, 2006-07-10 17:58:19 -, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Author: lauras
> Date: Mon Jul 10 17:58:18 2006
> New Revision: 115310
>
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115310
> Log:
> fixincludes:
> 2006-07-10  Laurynas Biveinis  <[EMAIL PROTECTED]>
>
>   PR bootstrap/20437
>   * Makefile.in (configure, config.h.in): change into $(srcdir)
>   before autoconf or autoheader call.

This patch broke building GCC because Makefile indention was done with
spaces instead of a TAB.

MfG, JBG

--
Jan-Benedict Glaw   [EMAIL PROTECTED]. +49-172-7608481 _ O _
"Eine Freie Meinung in  einem Freien Kopf| Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEsqzIHb1edYOZ4bsRAoAzAKCI6dFjebFeBfbroJu1T4VraTSOFACfRJVx
8zcf06CJD/ZYwyxDi5APgUo=
=RFuA
-END PGP SIGNATURE-






--
Laurynas


ICE in compute_frame_pointer_to_fb_displacement (building avr-gcc)

2006-07-10 Thread David Brownell
Hi,

I was building a AVR cross compiler from current GCC trunk, and got an error.
Build system was Ubuntu 6.06 on an Athlon, using the latest from CVS binutils
but otherwise configured exactly as shown in

  http://www.nongnu.org/avr-libc/user-manual/install_tools.html

The assertion failure that terminated the GCC build is appended.  It's very
easy to reproduce, but let me know if there's more info you need from me.

I'm guessing that either not many folk have tried to build a GCC that supports
the newest AVR chips, or those config+build instructions are wrong, since this
is an error I saw with a few other recent GCCs in the last month or so.

Anyone have a fix, workaround, or other suggestion?

- Dave


/home/tux/avr/gcc/obj-avr/./gcc/xgcc -B/home/tux/avr/gcc/obj-avr/./gcc/ 
-B/usr/local/avr/avr/bin/ -B/usr/local/avr/avr/lib/ -isystem 
/usr/local/avr/avr/include -isystem /usr/local/avr/avr/sys-include -O2  -O2 -g 
-O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -DDF=SF 
-Dinhibit_libc -mcall-prologues -Os -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED 
-Dinhibit_libc -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include 
-I../../gcc/../libcpp/include  -I../../gcc/../libdecnumber -I../libdecnumber 
-DL_clear_cache -c ../../gcc/libgcc2.c -o libgcc/./_clear_cache.o
../../gcc/libgcc2.c: In function '__clear_cache':
../../gcc/libgcc2.c:1992: internal compiler error: in 
compute_frame_pointer_to_fb_displacement, at dwarf2out.c:10452
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [libgcc/./_clear_cache.o] Error 1
make[3]: Leaving directory `/home/tux/avr/gcc/obj-avr/gcc'
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory `/home/tux/avr/gcc/obj-avr/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/tux/avr/gcc/obj-avr'
make: *** [all] Error 2


Re: request for new a syntactic design for C/C++.

2006-07-10 Thread Mike Stump

On Jul 9, 2006, at 10:52 PM, Vladimir 'Yu' Stepanov wrote:

I would like to offer one expansion for C/C++.


Did you just reinvent downcasting in C++?  If so, C++ already has  
that feature!?  As for C, C, I'd claim C already has that feature[1],  
you merely have to put in a #define into your library to make it look  
pretty.  In C, since this is a library issue, the compiler would be  
the wrong place to put the feature.  Since it can be done with a  
macro, there is little need to change the grammar of the language.



1 - Contentious, should be decided by C committee IMHO.


Re: Mainline build broken (was: r115310 - in /trunk: fixincludes/ChangeLog fixi...)

2006-07-10 Thread Laurynas Biveinis

This patch broke building GCC because Makefile indention was done with
spaces instead of a TAB.


Obvious fix commited, r115313. That will teach me how to think "oh
well that's a tiny patch I sent a month ago, I'll just copy it from
the mail archives instead of locating it on my disk".

Sorry.

--
Laurynas


Re: gcc breakage

2006-07-10 Thread Laurynas Biveinis

You forgot a ChangeLog entry for


r115313 | lauras | 2006-07-10 12:44:48 -0700 (Mon, 10 Jul 2006) | 2 lines

Fix spaces to tabs in the last commit.


I'm not sure. I think that my ChangeLog entry by my previous commit
(the breaking one) covers this change too, because if I had managed to
commit it correctly the first time, repository would be in the same
state as it is now.

Do such changes require ChangeLog entries? Should I commit it now?

--
Laurynas


Re: gcc breakage

2006-07-10 Thread Steve Kargl
On Mon, Jul 10, 2006 at 11:24:55PM +0300, Laurynas Biveinis wrote:
> >You forgot a ChangeLog entry for
> >
> >
> >r115313 | lauras | 2006-07-10 12:44:48 -0700 (Mon, 10 Jul 2006) | 2 lines
> >
> >Fix spaces to tabs in the last commit.
> 
> I'm not sure. I think that my ChangeLog entry by my previous commit
> (the breaking one) covers this change too, because if I had managed to
> commit it correctly the first time, repository would be in the same
> state as it is now.
> 
> Do such changes require ChangeLog entries? Should I commit it now?
> 

It's my understanding that every change requires a ChangeLog
entry.  There is now no consistent record of the difference
between 115310 and 115311 without actually looking at "svn log
fixincludes/Makefile.in".

Perhaps, a quick question on IRC of the correct protocol is
appropriate?

-- 
Steve


Re: gcc breakage

2006-07-10 Thread Daniel Jacobowitz
On Mon, Jul 10, 2006 at 01:34:12PM -0700, Steve Kargl wrote:
> It's my understanding that every change requires a ChangeLog
> entry.  There is now no consistent record of the difference
> between 115310 and 115311 without actually looking at "svn log
> fixincludes/Makefile.in".
> 
> Perhaps, a quick question on IRC of the correct protocol is
> appropriate?

It is fairly typical to omit the changelog entry in "fix my last patch"
commits.  Also in "fix the ChangeLog" commits.

-- 
Daniel Jacobowitz
CodeSourcery


/bin/sh: build/genmodes: No such file or directory (was Re: gcc-4.2-20060708 is now available)

2006-07-10 Thread henrik . sorensen
> Snapshot gcc-4.2-20060708 is now available on
>   ftp://gcc.gnu.org/pub/gcc/snapshots/4.2-20060708/
something is brkoen here ...
[~/gcc]
>../gcc-src/gcc-4.2-20060708/gcc/configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking LIBRARY_PATH variable... ok
checking GCC_EXEC_PREFIX variable... ok
checking whether to place generated files in the source directory... no
checking whether a default linker was specified... no
checking whether a default assembler was specified... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for inline... inline
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for void *... yes
checking size of void *... 4
checking for short... yes
checking size of short... 2
checking for int... yes
checking size of int... 4
checking for long... yes
checking size of long... 4
checking for long long... yes
checking for long long... (cached) yes
checking size of long long... 8
checking for __int64... no
checking whether gcc accepts -Wno-long-long... yes
checking whether gcc accepts -Wno-variadic-macros... no
checking whether gcc accepts -Wno-overlength-strings... no
checking whether gcc accepts -Wold-style-definition... yes
checking whether gcc accepts -Wmissing-format-attribute... yes
checking whether gcc accepts -Wc++-compat... no
checking valgrind.h usability... no
checking valgrind.h presence... no
checking for valgrind.h... no
checking whether make sets $(MAKE)... yes
checking for gawk... gawk
checking whether ln -s works... yes
checking whether ln works... yes
checking for ranlib... ranlib
checking for a BSD compatible install... /usr/bin/install -c
checking for cmp's capabilities... gnucompare
checking for mktemp... yes
checking for makeinfo... makeinfo
checking for modern makeinfo... yes
checking for recent Pod::Man... yes
checking for flex... flex
checking for bison... bison
checking for nm... nm
checking for ar... ar
checking for GNU C library... yes
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking whether string.h and strings.h may both be included... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for limits.h... yes
checking for stddef.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for time.h... yes
checking for iconv.h... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for sys/file.h... yes
checking for sys/time.h... yes
checking for sys/mman.h... yes
checking for sys/resource.h... yes
checking for sys/param.h... yes
checking for sys/times.h... yes
checking for sys/stat.h... (cached) yes
checking for direct.h... no
checking for malloc.h... yes
checking for langinfo.h... yes
checking for ldfcn.h... no
checking for locale.h... yes
checking for wchar.h... yes
checking for thread.h... no
checking for pthread.h... yes
checking for CHAR_BIT... yes
checking whether byte ordering is bigendian... no
checking for collect2 libraries... none required
checking for library containing exc_resume... no
checking for library containing ldexp... none required
checking for inttypes.h... yes
checking for times... yes
checking for clock... yes
checking for kill... yes
checking for getrlimit... yes
checking for setrlimit... yes
checking for atoll... yes
checking for atoq... no
checking for sysconf... yes
checking for strsignal... yes
checking for getrusage... yes
checking for nl_langinfo... yes
checking for scandir... yes
checking for alphasort... yes
checking for gettimeofday... yes
checking for mbstowcs... yes
checking for wcswidth... yes
checking for mmap... yes
checking for mincore... yes
checking for setlocale... yes
checking for clearerr_unlocked... yes
checking for feof_unlocked... yes
checking for ferror_unlocked... yes
checking for fflush_unlocked... yes
checking for fgetc_unlocked... yes
checking for fgets_unlocked... yes
checking for fileno_unlocked... yes
checking for fprintf_unlocked... no
checking for fputc_unlocked... yes
checking for fputs_unlocked... yes
checking for fread_unlocked... yes
checking for fwrite_

Re: gcc breakage

2006-07-10 Thread Mike Stump

On Jul 10, 2006, at 1:24 PM, Laurynas Biveinis wrote:

Do such changes require ChangeLog entries?


For my own beyond trivial fixes that I catch quickly (say, less than  
24 hours), normally I just fix them with a `fix typo' type svn log  
entry.  When in doubt, or if you're fixing someone else's work, or  
someone else filed a PR for it already, do up a changelog entry.  If  
other people notice, I'd be tempted to say, do up a changelog entry.


Re: ICE in compute_frame_pointer_to_fb_displacement (building avr-gcc)

2006-07-10 Thread Jim Wilson

David Brownell wrote:

/home/tux/avr/gcc/obj-avr/./gcc/xgcc -B/home/tux/avr/gcc/obj-avr/./gcc/ 
-B/usr/local/avr/avr/bin/ -B/usr/local/avr/avr/lib/ -isystem 
/usr/local/avr/avr/include -isystem /usr/local/avr/avr/sys-include -O2  -O2 -g 
-O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -DDF=SF 
-Dinhibit_libc -mcall-prologues -Os -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED 
-Dinhibit_libc -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include 
-I../../gcc/../libcpp/include  -I../../gcc/../libdecnumber -I../libdecnumber 
-DL_clear_cache -c ../../gcc/libgcc2.c -o libgcc/./_clear_cache.o
.../../gcc/libgcc2.c: In function '__clear_cache':
.../../gcc/libgcc2.c:1992: internal compiler error: in 
compute_frame_pointer_to_fb_displacement, at dwarf2out.c:10452


Looks like bug 26504.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26504
--
Jim Wilson, GNU Tools Support, http://www.specifix.com


Re: ICE in compute_frame_pointer_to_fb_displacement (building avr-gcc)

2006-07-10 Thread Andrew Pinski


On Jul 11, 2006, at 4:49 AM, David Brownell wrote:


Hi,

Anyone have a fix, workaround, or other suggestion?


Yes don't use --with-dwarf2 :).

This is PR 26504:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26504

Also someone should try the patch in PR 26015:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id= 26015:
Which most likely will also fix this.

-- Pinski


Running aclocal in libstdc++-v3 directory

2006-07-10 Thread Steve Ellcey

I am trying to make a configure change in the libstdc++-v3 directory but
when I run aclocal (even on an unmodified libstdc++-v3 directory from
the top-of-tree), I get an error message.  Does anyone else see this?

[hpsje] $ aclocal
aclocal:configure.ac:85: warning: macro `AM_PROG_LIBTOOL' not found in library
configure.ac:138: warning: AC_PROG_LD is m4_require'd but is not m4_defun'd
configure.ac:138: AC_PROG_LD is required by...
acinclude.m4:307: GLIBCXX_CHECK_LINKER_FEATURES is expanded from...
configure.ac:138: the top level

[hpsje] $ aclocal --version
aclocal (GNU automake) 1.9.6
Written by Tom Tromey <[EMAIL PROTECTED]>

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Re: Running aclocal in libstdc++-v3 directory

2006-07-10 Thread Daniel Jacobowitz
On Mon, Jul 10, 2006 at 03:14:36PM -0700, Steve Ellcey wrote:
> 
> I am trying to make a configure change in the libstdc++-v3 directory but
> when I run aclocal (even on an unmodified libstdc++-v3 directory from
> the top-of-tree), I get an error message.  Does anyone else see this?

My rule of thumb: Check the options in automake's generated
Makefile.in.

You probably need a -I path.

-- 
Daniel Jacobowitz
CodeSourcery


Re: Running aclocal in libstdc++-v3 directory

2006-07-10 Thread Steve Ellcey
> My rule of thumb: Check the options in automake's generated
> Makefile.in.
> 
> You probably need a -I path.
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery

Ah, I see "ACLOCAL_AMFLAGS = -I .  -I ..  -I ../config", if I add those
-I options to my aclocal call I get no errors or warnings when running
aclocal.

Thanks for the tip.

Steve Ellcey
[EMAIL PROTECTED]


Re: Running aclocal in libstdc++-v3 directory

2006-07-10 Thread Benjamin Kosnik

> I am trying to make a configure change in the libstdc++-v3 directory but
> when I run aclocal (even on an unmodified libstdc++-v3 directory from
> the top-of-tree), I get an error message.  Does anyone else see this?

The current fashion for regenerating the config/make bits is to just run:

autoreconf

at the top level libstdc++-v3 source directory.

-benjamin


[PATCH] Wcoercion: removed overflow check

2006-07-10 Thread Manuel López-Ibáñez

This patch is an improved version over the one proposed in
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00098.html
It doesn't introduce any features. The main difference is the removal
of TREE_CONSTANT_OVERFLOW check from real_isinteger function,
following the new policy about not handling overflow in the front end.
This patch also fixes some minor issues with whitespace and comments.
Thanks to Roger Sayle for his helpful comments.

Bootstrapped and tested in trunk revision 115112.

As the original one, it is composed by three patches:

wcoercion-1of3-split.patch : splits current functionality of
Wconversion in two different options and it modifies testcases
accordingly. (this one hasn't changed at all, it is included here for
completeness)
wcoercion-2of3-real_isinteger-2.patch : adds a new function which
detects when a real value can be exactly represented as an integer.
wcoercion-3of3-coercion_warning-2.patch : adds the new functionality and
testcases.
diff -pEbaur --unidirectional-new-file --exclude='*svn*' --exclude='*~' pristine/gcc/c-common.c wcoercion/gcc/c-common.c
--- pristine/gcc/c-common.c	2006-07-01 13:37:45.0 +0100
+++ wcoercion/gcc/c-common.c	2006-07-01 13:40:44.0 +0100
@@ -949,7 +949,7 @@ overflow_warning (tree value)
 }
 
 /* Print a warning if a large constant is truncated to unsigned,
-   or if -Wconversion is used and a constant < 0 is converted to unsigned.
+   or if -Wcoercion is used and a constant < 0 is converted to unsigned.
Invoke this function on every expression that might be implicitly
converted to an unsigned type.  */
 
@@ -969,7 +969,7 @@ unsigned_conversion_warning (tree result
 	warning (OPT_Woverflow,
 		 "large integer implicitly truncated to unsigned type");
   else
-	warning (OPT_Wconversion,
+	warning (OPT_Wcoercion,
 		 "negative integer implicitly converted to unsigned type");
 }
 }
diff -pEbaur --unidirectional-new-file --exclude='*svn*' --exclude='*~' pristine/gcc/c.opt wcoercion/gcc/c.opt
--- pristine/gcc/c.opt	2006-06-04 09:53:03.0 +0100
+++ wcoercion/gcc/c.opt	2006-06-25 20:33:21.0 +0100
@@ -141,6 +141,10 @@ Wchar-subscripts
 C ObjC C++ ObjC++ Var(warn_char_subscripts)
 Warn about subscripts whose type is \"char\"
 
+Wcoercion
+C ObjC C++ ObjC++ Var(warn_coercion)
+Warn for implicit type conversions that may change a value
+
 Wcomment
 C ObjC C++ ObjC++
 Warn about possibly nested block comments, and C++ comments spanning more than one physical line
@@ -150,8 +154,12 @@ C ObjC C++ ObjC++
 Synonym for -Wcomment
 
 Wconversion
-C ObjC C++ ObjC++ Var(warn_conversion)
-Warn about possibly confusing type conversions
+C++ ObjC++ Var(warn_conversion)
+Undocumented
+
+Wtraditional-conversion
+C ObjC Var(warn_traditional_conversion)
+Warn of prototypes causing type conversions different from what would happen in the absence of prototype
 
 Wctor-dtor-privacy
 C++ ObjC++ Var(warn_ctor_dtor_privacy)
diff -pEbaur --unidirectional-new-file --exclude='*svn*' --exclude='*~' pristine/gcc/c-typeck.c wcoercion/gcc/c-typeck.c
--- pristine/gcc/c-typeck.c	2006-07-01 13:38:05.0 +0100
+++ wcoercion/gcc/c-typeck.c	2006-07-01 13:40:43.0 +0100
@@ -2389,7 +2389,7 @@ convert_arguments (tree typelist, tree v
 	{
 	  /* Optionally warn about conversions that
 		 differ from the default conversions.  */
-	  if (warn_conversion || warn_traditional)
+	  if (warn_traditional_conversion || warn_traditional)
 		{
 		  unsigned int formal_prec = TYPE_PRECISION (type);
 
@@ -2465,8 +2465,8 @@ convert_arguments (tree typelist, tree v
 		}
 		  /* Detect integer changing in width or signedness.
 		 These warnings are only activated with
-		 -Wconversion, not with -Wtraditional.  */
-		  else if (warn_conversion && INTEGRAL_TYPE_P (type)
+		 -Wtraditional-conversion, not with -Wtraditional.  */
+		  else if (warn_traditional_conversion && INTEGRAL_TYPE_P (type)
 			   && INTEGRAL_TYPE_P (TREE_TYPE (val)))
 		{
 		  tree would_have_been = default_conversion (val);
@@ -2479,7 +2479,7 @@ convert_arguments (tree typelist, tree v
 			   and the actual arg is that enum type.  */
 			;
 		  else if (formal_prec != TYPE_PRECISION (type1))
-			warning (OPT_Wconversion, "passing argument %d of %qE "
+			warning (OPT_Wtraditional_conversion, "passing argument %d of %qE "
  "with different width due to prototype",
  argnum, rname);
 		  else if (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (type1))
@@ -2502,11 +2502,11 @@ convert_arguments (tree typelist, tree v
 			   && TYPE_UNSIGNED (TREE_TYPE (val)))
 			;
 		  else if (TYPE_UNSIGNED (type))
-			warning (OPT_Wconversion, "passing argument %d of %qE "
+			warning (OPT_Wtraditional_conversion, "passing argument %d of %qE "
  "as unsigned due to prototype",
  argnum, rname);
 		  else
-			warning (OPT_Wconversion, "passing argument %d of %qE "
+			warning (OPT_Wtraditional_conversion, "passing argument %d of %qE "
  "as signed

Re: make proto fails

2006-07-10 Thread Jim Wilson

Andreas Jaeger wrote:

# Fix for argument ‘clean_text_p’ might be clobbered by ‘longjmp’ or ‘vfork’
unprotoize.o-warn = -Wno-error


This is OK.

PR 21161 and PR 24239 are different instances of the same problem, so we 
don't need another bug report for this.  The previously mentioned PR 
21059 is a different issue.

--
Jim Wilson, GNU Tools Support, http://www.specifix.com


Someone broke darwin?

2006-07-10 Thread Mike Stump

Gosh, so close...

I found that the below patch gets me one step closer to it building.   
I'm sure it is wrong... but it should be enough of a hint for the  
right person to know how to fix it.


Doing diffs in libstdc++-v3:
--- libstdc++-v3/include/ext/codecvt_specializations.h.~1~   
2005-12-20 12:50:02.0 -0800
+++ libstdc++-v3/include/ext/codecvt_specializations.h  2006-07-10  
18:03:56.0 -0700

@@ -42,6 +42,8 @@
   // Define this here so codecvt.cc can have _S_max_size definition.
#define _GLIBCXX_USE_ENCODING_STATE 1
+#include 
+
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
   /// @brief  Extension to use icov for dealing with character  
encodings.

--

The next problem after that one is that:

/Volumes/mrs3/net/gcc-darwin/./gcc/xgcc -shared-libgcc -B/Volumes/ 
mrs3/net/gcc-darwin/./gcc -nostdinc++ -L/Volumes/mrs3/net/gcc-darwin/ 
powerpc-apple-darwin8.5.0/libstdc++-v3/src -L/Volumes/mrs3/net/gcc- 
darwin/powerpc-apple-darwin8.5.0/libstdc++-v3/src/.libs -B/Volumes/ 
mrs3/Packages/gcc-20060518/powerpc-apple-darwin8.5.0/bin/ -B/Volumes/ 
mrs3/Packages/gcc-20060518/powerpc-apple-darwin8.5.0/lib/ -isystem / 
Volumes/mrs3/Packages/gcc-20060518/powerpc-apple-darwin8.5.0/include - 
isystem /Volumes/mrs3/Packages/gcc-20060518/powerpc-apple-darwin8.5.0/ 
sys-include -Winvalid-pch -Wno-deprecated -x c++-header -g -O2  -I/ 
Volumes/mrs3/net/gcc-darwin/powerpc-apple-darwin8.5.0/libstdc++-v3/ 
include/powerpc-apple-darwin8.5.0 -I/Volumes/mrs3/net/gcc-darwin/ 
powerpc-apple-darwin8.5.0/libstdc++-v3/include -I/Volumes/mrs3/net/ 
gcc/libstdc++-v3/libsupc++ -O2 -g /Volumes/mrs3/net/gcc/libstdc++-v3/ 
include/precompiled/extc++.h -o powerpc-apple-darwin8.5.0/bits/extc+ 
+.h.gch/O2g.gch
/Volumes/mrs3/net/gcc-darwin/powerpc-apple-darwin8.5.0/libstdc++-v3/ 
include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:235: internal  
compiler error: Bus error

Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [powerpc-apple-darwin8.5.0/bits/extc++.h.gch/O2g.gch]  
Error 1


die...  :-(  Not yet sure why...


Re: /bin/sh: build/genmodes: No such file or directory (was Re: gcc-4.2-20060708 is now available)

2006-07-10 Thread henrik . sorensen
On Monday 10 July 2006 22:42, [EMAIL PROTECTED] wrote:
> > Snapshot gcc-4.2-20060708 is now available on
> >   ftp://gcc.gnu.org/pub/gcc/snapshots/4.2-20060708/
>
> something is brkoen here ...
> [~/gcc]
>
> >../gcc-src/gcc-4.2-20060708/gcc/configure
>

ups, should of course have been
../gcc-src/gcc-4.2-20060708/configure



Re: ICE in compute_frame_pointer_to_fb_displacement (building avr-gcc)

2006-07-10 Thread David Brownell
> > Anyone have a fix, workaround, or other suggestion?
> 
> Yes don't use --with-dwarf2 :).

Only a short term workaround... ;)


> This is PR 26504:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26504

Comment #8 there seems on-the-mark, so the PR 26015 fix has
two half-confirmations now:

> Also someone should try the patch in PR 26015:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26015:

Which assumes the frame pointer is in a register (pair) on
AVR ... seems normally true (r29:r28 == Y), but maybe someone
more AVR-savvy should verify there are no nasty corner cases.


> Which most likely will also fix this.

Comment #8 said that the AVR version of that VAX patch
helped -- and I got past that in the build, see my AVR SVN
patch attached -- but there was a second issue with libssp
that he worked around with "configure ... --disable-libssp".


I took a quick look at the libssp thing, and it looks like
maybe it's being built too early ... the linker needs some
chip-specfic runtime (crts8515.o) that won't exist until
AVR-libc gets built -- well after gcc gets built, that is.

So, I have a successful build but haven't yet tried to
flash and run the code yet.  I'll let you know later if
this compiler actually _works_ ... thanks!

- Dave


"make" in object directory gave:

Checking multilib configuration for libssp...
mkdir -p -- avr/libssp
Configuring in avr/libssp
configure: creating cache ./config.cache
checking build system type... i686-pc-linux-gnu
checking host system type... avr-unknown-none
checking target system type... avr-unknown-none
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for avr-strip... /usr/local/avr/avr/bin/strip
checking for --enable-version-specific-runtime-libs... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for avr-gcc... /home/tux/avr/gcc/obj-avr/./gcc/xgcc 
-B/home/tux/avr/gcc/obj-avr/./gcc/ -B/usr/local/avr/avr/bin/ 
-B/usr/local/avr/avr/lib/ -isystem /usr/local/avr/avr/include -isystem 
/usr/local/avr/avr/sys-include
checking for C compiler default output file name... configure: error: C 
compiler cannot create executables
See `config.log' for more details.
make[1]: *** [configure-target-libssp] Error 1
make[1]: Leaving directory `/home/tux/avr/gcc/obj-avr'
make: *** [all] Error 2
Command exited with non-zero status 2

avr/libssp/config.log held:

configure:2307: checking for C compiler default output file name
configure:2310: /home/tux/avr/gcc/obj-avr/./gcc/xgcc 
-B/home/tux/avr/gcc/obj-avr/./gcc/ -B/usr/local/avr/avr/bin/ 
-B/usr/local/avr/avr/lib/ -isystem /usr/local/avr/avr/include -isystem 
/usr/local/avr/avr/sys-include -O2 -g -O2conftest.c  >&5
/usr/local/avr/avr/bin/ld: crts8515.o: No such file: No such file or directory
configure:2313: $? = 1
configure: failed program was:
| /* elided, it's perfectly legit and not the problem */
configure:2352: error: C compiler cannot create executables
This gets GCC to build on AVR-8 "--with-dwarf2"; a "--disable-libssp"
is necessary too, and should maybe be the default.

--- gcc/config/avr/avr.h	(revision 115307)
+++ gcc/config/avr/avr.h	(working copy)
@@ -271,6 +271,8 @@
 
 #define FIRST_PARM_OFFSET(FUNDECL) 0
 
+#define FRAME_POINTER_CFA_OFFSET(FUNDECL) 0
+
 #define STACK_BOUNDARY 8
 
 #define STACK_POINTER_REGNUM 32


Re: Someone broke darwin?

2006-07-10 Thread Mike Stump

On Jul 10, 2006, at 6:20 PM, Mike Stump wrote:

The next problem after that one is that:

ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:235: internal  
compiler error: Bus error

Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [powerpc-apple-darwin8.5.0/bits/extc++.h.gch/O2g.gch]  
Error 1


Curious, not caused by changes in gcc/cp since 113399, so the  
regression appears to be a libstdc++ issue.  Anyway, I've tracked the  
issue down to mangling the type for pch, and with this change:


Doing diffs in .:
--- ./mangle.c.~1~  2006-07-10 18:56:25.0 -0700
+++ ./mangle.c  2006-07-10 19:16:52.0 -0700
@@ -2306,7 +2306,8 @@ write_template_arg (tree node)
 /* A template appearing as a template arg is a template  
template arg.  */

 write_template_template_arg (node);
   else if ((TREE_CODE_CLASS (code) == tcc_constant && code !=  
PTRMEM_CST)

-  || (abi_version_at_least (2) && code == CONST_DECL))
+  || (abi_version_at_least (2) && code == CONST_DECL
+  && TREE_CODE (DECL_INITIAL (node)) != SCOPE_REF))
 write_template_arg_literal (node);
   else if (DECL_P (node))
 {
--

it then encodes:

(gdb) pt

local bindings <0x2e72438>> value simple_value>> context 
heap_>
chain >
readonly constant invariant private VOID file /Volumes/mrs3/net/ 
gcc-darwin/powerpc-apple-darwin8.5.0/libstdc++-v3/inc\

lude/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp line 117
align 1 context binary_heap_> initial 

chain >

arg 0  type_0 type_5 type_6  
VOID
align 8 symtab 0 alias set -1 context 0x2d83930 detail>

no-binfo use_template=1 interface-unknown
chain >>
arg 1 
local bindings <0x0>>>

as something like:

LZNS5_12simple_valueEE

I've not had a chance to think about it, so don't know if that is  
right or not.  Someone else care to let me know if I'm on the right  
track?


If so, someone wanna approve it for mainline to get us bootstrapping  
again?


Re: [PATCH] Wcoercion: removed overflow check

2006-07-10 Thread Eric Botcazou
> This patch is an improved version over the one proposed in

Please avoid cross-posting.  This should go on [EMAIL PROTECTED] only.

-- 
Eric Botcazou