Re: BUG: assuming signed overflow does not occur when simplifying conditional to constant

2012-12-29 Thread Florian Weimer
* Bruce Korb:

> I wrote a loop that figures out how many items are in a list,
> counts down from that count to -1, changes direction and counts
> up from 0 to the limit, a la:
>
>
> inc  = -1;
> int idx = 0;
> while (opts->papzHomeList[idx+1] != NULL)
> idx++;
> for (;;) {
> if (idx < 0) {  <<<=== line 1025
> inc = 1;
> idx = 0;
> }
> char const * path = opts->papzHomeList[ idx ];
> if (path == NULL)
> break;
> idx += inc;
> //  do a bunch of stuff
> }
>
> ../../autoopts/configfile.c: In function 'intern_file_load':
> ../../autoopts/configfile.c:1025:12: error: assuming signed overflow does not 
> occur \
> when simplifying conditional to constant [-Werror=strict-overflow]

I can't reproduce this.  Can you post a minimal example that actually
shows this warning?

> My guess is that some code somewhere presumes that "idx" never gets
> decremented.  Not true.

The warning can trigger after inlining and constant propogation,
somewhat obscuring its cause.  PR55616 is one such example.


Re: BUG: assuming signed overflow does not occur when simplifying conditional to constant

2012-12-29 Thread Bruce Korb
Hi Florian,

On Sat, Dec 29, 2012 at 2:38 AM, Florian Weimer  wrote:
>> ../../autoopts/configfile.c: In function 'intern_file_load':
>> ../../autoopts/configfile.c:1025:12: error: assuming signed overflow does 
>> not occur \
>> when simplifying conditional to constant [-Werror=strict-overflow]
>
> I can't reproduce this.  Can you post a minimal example that actually
> shows this warning?

Not easily.  git clone git://git.savannah.gnu.org/autogen.git
I'd have to prune code until I can't prune more.  Unfortunately,
I don't have that kind of time.  I do wish I did.

>> My guess is that some code somewhere presumes that "idx" never gets
>> decremented.  Not true.
>
> The warning can trigger after inlining and constant propogation,
> somewhat obscuring its cause.  PR55616 is one such example.

It was clear it was some sort of optimization triggered issue.
I'd guess that since the program would not function if the condition
expression were optimized into a constant, then, therefore, the
warning trigger was faulty.  The message itself was also obtuse.

Thank you for taking the time to think over the issue.

Regards, Bruce


Re: BUG: assuming signed overflow does not occur when simplifying conditional to constant

2012-12-29 Thread Florian Weimer
* Bruce Korb:

> Hi Florian,
>
> On Sat, Dec 29, 2012 at 2:38 AM, Florian Weimer  wrote:
>>> ../../autoopts/configfile.c: In function 'intern_file_load':
>>> ../../autoopts/configfile.c:1025:12: error: assuming signed overflow does 
>>> not occur \
>>> when simplifying conditional to constant [-Werror=strict-overflow]
>>
>> I can't reproduce this.  Can you post a minimal example that actually
>> shows this warning?
>
> Not easily.  git clone git://git.savannah.gnu.org/autogen.git

Uhm, I get:

configure.ac:30: error: AC_INIT should be called with package and version 
arguments

> I'd have to prune code until I can't prune more.

Preprocessed sources would be helpful.  It seems that the header file
I need is generated and is not valid C99 without suitable preprocessor
definitions, so I can't get to this point myself.


Re: BUG: assuming signed overflow does not occur when simplifying conditional to constant

2012-12-29 Thread Bruce Korb
(Tarball attachment (75K) stripped.)

On 12/29/12 10:56, Florian Weimer wrote:
>> Not easily.  git clone git://git.savannah.gnu.org/autogen.git
> 
> Uhm, I get:
> 
> configure.ac:30: error: AC_INIT should be called with package and version 
> arguments

I ought to have directed you to a pre-release tarball.  Sorry.
The GIT source needs to be bootstrapped.

> libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../autoopts \
> -I.. -I.. -I../.. -I../autoopts -I../../autoopts \
> -DPKGDATADIR=\"/u/bkorb/ag/ag/autogen-5.17.1pre3/_inst/share/autogen\" \
> -g -O2 -Wall -Werror -Wcast-align -Wmissing-prototypes -Wpointer-arith \
> -Wshadow -Wstrict-prototypes -Wwrite-strings -Wno-format-contains-nul \
> -fno-strict-aliasing -Wstrict-aliasing=2 -Wextra -Wconversion \
> -Wsign-conversion -Wstrict-overflow -MT libopts_la-libopts.lo \
> -MD -MP -MF .deps/libopts_la-libopts.Tpo \
> -c libopts.c  -fPIC -DPIC \
> -o .libs/libopts_la-libopts.o
> In file included from libopts.c:22:0:
> ../../autoopts/configfile.c: In function 'intern_file_load':
> ../../autoopts/configfile.c:1025:12: error: assuming signed overflow does not 
> occur when simplifying conditional to constant [-Werror=strict-overflow]
> cc1: all warnings being treated as errors
> make[4]: *** [libopts_la-libopts.lo] Error 1
> make[4]: Leaving directory `/u/bkorb/ag/ag/autogen-5.17.1pre3/_build/autoopts'
> make[3]: *** [all-recursive] Error 1
> make[3]: Leaving directory `/u/bkorb/ag/ag/autogen-5.17.1pre3/_build/autoopts'

>> I'd have to prune code until I can't prune more.
> 
> Preprocessed sources would be helpful.

Interesting.  Capturing the above command line, preprocessing and then
compiling yields different messages:

> libopts.i: In function 'gnu_dev_major':
> libopts.i:137:3: error: negative integer implicitly converted to unsigned 
> type [-Werror=sign-conversion]
> libopts.i:137:33: error: conversion to 'unsigned int' from 'long long 
> unsigned int' may alter its value [-Werror=conversion]
> libopts.i: In function 'gnu_dev_minor':
> libopts.i:142:3: error: negative integer implicitly converted to unsigned 
> type [-Werror=sign-conversion]
> libopts.i:142:25: error: conversion to 'unsigned int' from 'long long 
> unsigned int' may alter its value [-Werror=conversion]
> libopts.i: In function 'gnu_dev_makedev':
> libopts.i:148:4: error: negative integer implicitly converted to unsigned 
> type [-Werror=sign-conversion]
> libopts.i:149:4: error: negative integer implicitly converted to unsigned 
> type [-Werror=sign-conversion]
> libopts.i: In function '__sigismember':
> libopts.i:424:174: error: conversion to 'long unsigned int' from 'int' may 
> change the sign of the result [-Werror=sign-conversion]
> libopts.i:424:254: error: conversion to 'long unsigned int' from 'int' may 
> change the sign of the result [-Werror=sign-conversion]
> libopts.i: In function '__sigaddset':
> libopts.i:425:165: error: conversion to 'long unsigned int' from 'int' may 
> change the sign of the result [-Werror=sign-conversion]
> libopts.i:425:245: error: conversion to 'long unsigned int' from 'int' may 
> change the sign of the result [-Werror=sign-conversion]
> libopts.i: In function '__sigdelset':
> libopts.i:426:165: error: conversion to 'long unsigned int' from 'int' may 
> change the sign of the result [-Werror=sign-conversion]
> libopts.i:426:245: error: conversion to 'long unsigned int' from 'int' may 
> change the sign of the result [-Werror=sign-conversion]
> libopts.i: In function 'fputc_unlocked':
> libopts.i:1253:3: error: conversion to 'char' from 'int' may alter its value 
> [-Werror=conversion]
> libopts.i: In function 'putc_unlocked':
> libopts.i:1258:3: error: conversion to 'char' from 'int' may alter its value 
> [-Werror=conversion]
> libopts.i: In function 'putchar_unlocked':
> libopts.i:1263:3: error: conversion to 'char' from 'int' may alter its value 
> [-Werror=conversion]
> cc1: all warnings being treated as error

I stripped away the line information.  Ah.  Of course.  GCC no longer knows 
what is
derived from system headers. :)  configfile.c:1025 maps to libopts.i:5416 and
the compiler doesn't get that far.

$ gcc --version
gcc (SUSE Linux) 4.7.1 20120723 [gcc-4_7-branch revision 189773]
Copyright (C) 2012 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.

Some of this pre-processed code gets pretty bizarre:

> if ( ((__extension__ (__builtin_constant_p (len) && ((__builtin_constant_p 
> (txt+1) && strlen (txt+1) < ((size_t) (len))) || (__builtin_constant_p 
> (opts->pzPROGNAME) && strlen (opts->pzPROGNAME) < ((size_t) (len ? 
> __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (txt+1) && 
> __builtin_constant_p (opts->pzPROGNAME) && (__s1_len = strlen (txt+1), 
> __s2_len = strlen (opts->pzPROGNAME), (!((size_t)(const void *)((txt+1) + 1) 
> - (size_

gcc-4.7-20121229 is now available

2012-12-29 Thread gccadmin
Snapshot gcc-4.7-20121229 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.7-20121229/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.7 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch 
revision 194753

You'll find:

 gcc-4.7-20121229.tar.bz2 Complete GCC

  MD5=325f082c662668ceedf2a293f155b362
  SHA1=67441eb8a0f0243f5be86a9d308d5930c91adf14

Diffs from 4.7-20121222 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.7
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Built gcc 4.7.2 on Ubuntu 10.04.4 LTS under virtualbox under XP

2012-12-29 Thread Sidney Marshall
I successfully built gcc 4.7.2 on Ubuntu 10.04.4 LTS under virtualbox 
under XP. The whole process had no problems - there were some minor errors 
reported from testing.


output from config.guess = i686-pc-linux-gnu

gcc -v output:

Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.7.2/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7.2/libexec/gcc/i686-pc-linux-gnu/4.7.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.7.2/configure --prefix=/usr/local/gcc-4.7.2
Thread model: posix
gcc version 4.7.2 (GCC)

I did a full download and a full build of all default languages (I 
had previously had trouble building a subset of languages for a 
previous version of 4.7)


$ more /etc/issue
Ubuntu 10.04.4 LTS \n \l

$ uname -a
Linux sidney-vbox 2.6.32-45-generic #101-Ubuntu SMP Mon Dec 3 15:41:13 UTC 
2012 i686 GNU/Linux


$ dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| 
Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend

|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name   VersionDescription
+++-==-==-
ii  libc6  2.11.1-0ubuntu Embedded GNU C Library: Shared libraries

--Sidney Marshall


Using a 'V' constraint with QI mode....

2012-12-29 Thread Alan Lehotsky
The V constraint is essentially implemented by checking that the addressing 
mode presented is NOT offsettable.  But that's done by adding 
GET_MODE_SIZE(mode) - 1.

I've got a machine that supports indirection but not offsetting or indexing.  
But the V constraint fails for any 

(mem:QI (reg:SI p0 ) )

Am I missing some trick that would allow me to make effective use of V?