make check stops after one case in asan.exp

2013-01-19 Thread Bin.Cheng
Hi,
I ran into a problem that gcc make check stops after one case in
asan.exp, here is the dump information:

Executed ./sleep-before-dying-1.exe, status 1
=
==30519== ERROR: AddressSanitizer: heap-use-after-free on address
0x41869fc5 at pc 0x80486dd bp 0xbf8f3728 sp 0xbf8f371c
READ of size 1 at 0x41869fc5 thread T0
#0 0x80486dc
(/home/.../build/gcc/testsuite/gcc/sleep-before-dying-1.exe+0x80486dc)
#1 0x41598b55 (/lib/tls/i686/cmov/libc-2.10.1.so+0x16b55)
#2 0x8048580
(/home/.../build/gcc/testsuite/gcc/sleep-before-dying-1.exe+0x8048580)
0x41869fc5 is located 5 bytes inside of 10-byte region [0x41869fc0,0x41869fca)
freed by thread T0 here:
#0 0x40069004
(/home/.../build/i686-pc-linux-gnu/libsanitizer/asan/.libs/libasan.so.0.0.0+0x10004)
#1 0x80486af
(/home/.../build/gcc/testsuite/gcc/sleep-before-dying-1.exe+0x80486af)
#2 0x41598b55 (/lib/tls/i686/cmov/libc-2.10.1.so+0x16b55)
#3 0x8048580
(/home/.../build/gcc/testsuite/gcc/sleep-before-dying-1.exe+0x8048580)
previously allocated by thread T0 here:
#0 0x400690e4
(/home/.../build/i686-pc-linux-gnu/libsanitizer/asan/.libs/libasan.so.0.0.0+0x100e4)
#1 0x80486a5
(/home/.../build/gcc/testsuite/gcc/sleep-before-dying-1.exe+0x80486a5)
#2 0x41598b55 (/lib/tls/i686/cmov/libc-2.10.1.so+0x16b55)
#3 0x8048580
(/home/.../build/gcc/testsuite/gcc/sleep-before-dying-1.exe+0x8048580)
Shadow bytes around the buggy address:
  0x2830d3a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d3b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d3c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d3d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d3e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x2830d3f0: fa fa fa fa fa fa fa fa[fd]fd fd fd fd fd fd fd
  0x2830d400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d410: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d420: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d430: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x2830d440: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:   00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone: fa
  Heap righ redzone: fb
  Freed Heap region: fd
  Stack left redzone:f1
  Stack mid redzone: f2
  Stack right redzone:   f3
  Stack partial redzone: f4
  Stack after return:f5
  Stack use after scope: f8
  Global redzone:f9
  Global init order: f6
  Poisoned by user:  f7
  ASan internal: fe
Stats: 0M malloced (0M for red zones) by 1 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 1 calls
Stats: 0M really freed by 0 calls
Stats: 0M (0M-0M) mmaped; 1 maps, 0 unmaps
  mmaps   by size class: 7:4095;
  mallocs by size class: 7:1;
  frees   by size class: 7:1;
  rfrees  by size class:
Stats: malloc large: 0 small slow: 1
Stats: StackDepot: 0 ids; 0M mapped
==30519== ABORTING
==30519== Sleeping for 1 second(s)

ERROR: (DejaGnu) proc "lreverse {{ASAN_OPTIONS 0}}" does not exist.
The error code is CHILDSTATUS 30519 1
The info on the error is:
child process exited abnormally
while executing
"close file8"

make check just exists after this error and I can only get partial
test results like:

=== g++ Summary ===

# of expected passes192
# of unsupported tests  9

So anything I missed?  Thanks very much.

The gcc is configured with :
../gcc/configure
   --prefix=/home/.../target/
   --with-gmp=/home/.../usr/
   --with-mpfr=/home/.../usr/
   --with-mpc=/home/.../usr/
   --with-ppl=/home/.../usr/
   --with-cloog=/home/.../usr/
   --with-host-libstdcxx='-static-libgcc
-Wl,-L/usr/lib/gcc/i486-linux-gnu/4.4.1/,-Bstatic,-lstdc++,-Bdynamic
-lm'
   --enable-languages=c,c++,lto

The triplet should be i686-pc-linux-gnu by default.


-- 
Best Regards.


Re: make check stops after one case in asan.exp

2013-01-19 Thread Andreas Schwab
"Bin.Cheng"  writes:

> ERROR: (DejaGnu) proc "lreverse {{ASAN_OPTIONS 0}}" does not exist.

What is the version of tcl you are using?  Perhaps it doesn't know about
lreverse yet (which was added in tcl-8.5).

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: make check stops after one case in asan.exp

2013-01-19 Thread Bin.Cheng
On Sat, Jan 19, 2013 at 5:52 PM, Andreas Schwab  wrote:
> "Bin.Cheng"  writes:
>
>> ERROR: (DejaGnu) proc "lreverse {{ASAN_OPTIONS 0}}" does not exist.
>
> What is the version of tcl you are using?  Perhaps it doesn't know about
> lreverse yet (which was added in tcl-8.5).

My version is tcl-8.4, I will update it and try again.
Thanks for helping.
--
Best Regards.


gcc 4.7 regression on bool function specialization

2013-01-19 Thread Jason A. Donenfeld
/*
 *
 * The output of this with gcc 4.7.2 is:
 *
 * 1
 * 2
 * this generic-int function should not be called
 * 0
 *
 *
 *
 * The output of this with gcc 4.6.3 is:
 *
 * 1
 * 2
 * this type-bool function SHOULD BE called
 * 1
 *
 */

#include 
#include 
#include 
#include 

struct Type { int dummy; };

template 
inline T extractTag(const M &map, const char *key)
{
if (!strcmp(key, "blah-bool"))
std::cout << "this generic-int function should not be called" 
<< std::endl;
T ret = 0;
std::istringstream stream(extractTag(map, key));
stream >> ret;
return ret;
}
template 
inline bool extractTag(const M &map, const char *key)
{
if (!strcmp(key, "blah-bool"))
std::cout << "this generic-bool function should not be called" 
<< std::endl;
std::string str(extractTag(map, key));
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
return (str == "1" || str == "true");
}
template <>
inline unsigned int extractTag(const Type&, const char *key)
{
return 2;
}
template <>
inline std::string extractTag(const Type&, const char *key)
{
if (!strcmp(key, "blah-int"))
return "1";
if (!strcmp(key, "blah-unsigned-int"))
return "-should-not-be-reached-";
if (!strcmp(key, "blah-bool"))
return "true";
return "invalid";
}
template <>
inline bool extractTag(const Type&, const char *key)
{
if (!strcmp(key, "blah-bool"))
std::cout << "this type-bool function SHOULD BE called" << 
std::endl;
return true;
}

int main(int argc, char *argv[])
{
Type t;
std::cout << extractTag(t, "blah-int") << std::endl;
std::cout << extractTag(t, "blah-unsigned-int") << 
std::endl;
std::cout << extractTag(t, "blah-bool") << std::endl;
return 0;
}


Re: gcc 4.7 regression on bool function specialization

2013-01-19 Thread Jonathan Wakely
N.B. This mail is not appropriate on this mailing list, which is for
discussion of development of GCC. For help with GCC use the gcc-help
list or to report bugs use bugzilla, thanks.


On 19 January 2013 18:58, Jason A. Donenfeld wrote:
> /*
>  *
>  * The output of this with gcc 4.7.2 is:
>  *
>  * 1
>  * 2
>  * this generic-int function should not be called
>  * 0

This is the correct behaviour, the old behaviour was a bug.



> struct Type { int dummy; };
>
> template 
> inline T extractTag(const M &map, const char *key)
> {
> if (!strcmp(key, "blah-bool"))
> std::cout << "this generic-int function should not be called" 
> << std::endl;
> T ret = 0;
> std::istringstream stream(extractTag(map, key));
> stream >> ret;
> return ret;
> }
> template 
> inline bool extractTag(const M &map, const char *key)
> {
> if (!strcmp(key, "blah-bool"))
> std::cout << "this generic-bool function should not be 
> called" << std::endl;
> std::string str(extractTag(map, key));
> std::transform(str.begin(), str.end(), str.begin(), ::tolower);
> return (str == "1" || str == "true");
> }

This is not a partial specialization (you cannot have partial
specializations of function templates only class templates)so  this is
a new overload of extractTag with a single template parameter.

> template <>
> inline bool extractTag(const Type&, const char *key)
> {
> if (!strcmp(key, "blah-bool"))
> std::cout << "this type-bool function SHOULD BE called" << 
> std::endl;
> return true;
> }

This is a specialization of extractTag not extractTag, so
cannot be called by extractTag(t, "blah-bool") because argument
deduction fails.


gcc-4.7-20130119 is now available

2013-01-19 Thread gccadmin
Snapshot gcc-4.7-20130119 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.7-20130119/
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 195313

You'll find:

 gcc-4.7-20130119.tar.bz2 Complete GCC

  MD5=a9e07a51292d8b84e2b162bf328d06e3
  SHA1=a37817fd386afd099d62d026bbc38e9aca695ef3

Diffs from 4.7-20130112 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.


Re: GCC cannot move address calculation to store+load?

2013-01-19 Thread Xinliang David Li
A related discussion in this thread:
http://gcc.gnu.org/ml/gcc/2013-01/msg00215.html

On Fri, Jan 18, 2013 at 7:57 AM, Miles Bader  wrote:
> Richard Biener  writes:
>> Note that combine does not apply because %eax is used multiple
>> times.  This also means that for code-size the combining is not a good
>> idea.
>
> Though the lea instruction seems rather large, so in fact the code is
> a fair bit smaller without it, e.g. as generated by clang/llvm:
>
> clang/llvm 3.1 (-O2 -m32):
>
>  :
>0:   8b 44 24 08 mov0x8(%esp),%eax
>4:   8b 4c 24 04 mov0x4(%esp),%ecx
>8:   8b 14 c1mov(%ecx,%eax,8),%edx
>b:   89 15 00 00 00 00   mov%edx,0x0
>   11:   89 04 c1mov%eax,(%ecx,%eax,8)
>   14:   31 c0   xor%eax,%eax
>   16:   c3  ret
>
> gcc 4.8 20130113 (-O2 -m32):
>
>  :
>0:   8b 54 24 08 mov0x8(%esp),%edx
>4:   8d 04 d5 00 00 00 00lea0x0(,%edx,8),%eax
>b:   03 44 24 04 add0x4(%esp),%eax
>f:   8b 08   mov(%eax),%ecx
>   11:   89 0d 00 00 00 00   mov%ecx,0x0
>   17:   89 10   mov%edx,(%eax)
>   19:   31 c0   xor%eax,%eax
>   1b:   c3  ret
>
> -miles
>
> --
> Ich bin ein Virus. Mach' mit und kopiere mich in Deine .signature.