[Bug c++/61718] Visibility issue with template class

2014-07-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61718

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Andrew Pinski  ---
>  defaulthidden

Simple since YYY is hidden (by the paragma), XXX has to be also hidden
because there is no way to export the class XXX since it depends on the
visibility of YYY.  If you think it should have been visible, then you will can
get an One definition rule violation if another shared library has a class
named YYY.


[Bug c++/61718] Visibility issue with template class

2014-07-05 Thread goughost at yahoo dot com.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61718

--- Comment #2 from goughost  ---
(In reply to Andrew Pinski from comment #1)
> >  defaulthidden
> 
> Simple since YYY is hidden (by the paragma), XXX has to be also hidden
> because there is no way to export the class XXX since it depends on
> the visibility of YYY.  If you think it should have been visible, then you
> will can get an One definition rule violation if another shared library has
> a class named YYY.

So it's a bug in firefox:
``https://bugzilla.mozilla.org/show_bug.cgi?id=1034798``_.


[Bug c++/61719] New: misleading error message

2014-07-05 Thread drepper.fsp+rhbz at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61719

Bug ID: 61719
   Summary: misleading error message
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: drepper.fsp+rhbz at gmail dot com

This happens with older versions as well and the problem is worse in more
complicated situations.  This is the boiled-down version.  Take this source:

struct c {
  c(int a) : aa(a {}
  int aa;
};

c v(1);


There clearly is a type in the constructor call, the closing parenthesis is
missing.  This causes the scanner to read the remainder of the file looking for
the end of the initializer of the call.  The error messages you get are:

u.cc: In constructor ‘c::c(int)’:
u.cc:2:14: error: class ‘c’ does not have any field named ‘aa’
   c(int a) : aa(a {}
  ^
u.cc:2:19: error: expected ‘)’ before ‘{’ token
   c(int a) : aa(a {}
   ^
u.cc:3:7: error: expected ‘{’ at end of input
   int aa;
   ^

Yes, the second error points in the right direction but in more complicated
situations there can be even more messages between the first message and the
one in second place here.

It seems that despite an error token being returned when looking for the end of
the initializer for aa the compiler first performs a lookup of the member which
of course makes no sense in this case since the remainder of the class is not
parsed.

I think something better can be done, maybe just skip looking up the member to
be initialized if there is a syntax error in the initializer call itself.

[Bug libstdc++/61720] New: std::regex_search matches incorrectly

2014-07-05 Thread husky.puppy at mail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61720

Bug ID: 61720
   Summary: std::regex_search matches incorrectly
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: husky.puppy at mail dot com

Created attachment 33072
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33072&action=edit
Preprocessed sourcce code

When using std::regex_search to match the string R"("test\")" against the
regular expression R"("([^"]|\\")*[^\\]")", it incorrectly finds a match. The
std::regex_match on the other hand works as expected.

Source:
#include 
#include 

int main()
{
  std::string test = R"("test\")";
  std::regex regex(R"("([^"]|\\")*[^\\]")");
  std::smatch match;
  std::regex_search(test, match, regex);
  std::cout << "search: " << match.str() << std::endl;
  std::regex_match(test, match, regex);
  std::cout << "match:  " << match.str() << std::endl;
  return 0;
}

Output:
search: "test\"
match:  

Command Line:
g++ -std=c++11 -Wall -Werror test.cpp

GCC Info:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.0-9'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--disable-vtable-verify --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.0 (Debian 4.9.0-9) 

System Info:
Linux server 3.14-1-amd64 #1 SMP Debian 3.14.9-1 (2014-06-30) x86_64 GNU/Linux


[Bug middle-end/61225] [4.10 Regression] Several new failures after r210458 on x86_64-*-* with -m32

2014-07-05 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61225

--- Comment #9 from Dominique d'Humieres  ---
> FAIL: gcc.target/i386/pr49095.c scan-assembler-not test[lq]

Still failing after revision r210921 (-m32 only).


[Bug target/49423] [4.8/4.9/4.10 Regression] [arm] internal compiler error: in push_minipool_fix

2014-07-05 Thread cbaylis at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49423

--- Comment #29 from cbaylis at gcc dot gnu.org ---
Author: cbaylis
Date: Sat Jul  5 11:58:06 2014
New Revision: 212303

URL: https://gcc.gnu.org/viewcvs?rev=212303&root=gcc&view=rev
Log:
[ARM] PR target/49423

2014-07-05  Charles Baylis  

PR target/49423
* config/arm/arm-protos.h (arm_legitimate_address_p,
arm_is_constant_pool_ref): Add prototypes.
* config/arm/arm.c (arm_legitimate_address_p): Remove static.
(arm_is_constant_pool_ref) New function.
* config/arm/arm.md (unaligned_loadhis, arm_zero_extendhisi2_v6,
arm_zero_extendqisi2_v6): Use Uh constraint for memory operand.
(arm_extendhisi2, arm_extendhisi2_v6): Use Uh constraint for memory
operand. Remove pool_range and neg_pool_range attributes.
(arm_extendqihi_insn, arm_extendqisi, arm_extendqisi_v6): Remove
pool_range and neg_pool_range attributes.
* config/arm/constraints.md (Uh): New constraint.
(Uq): Don't allow constant pool references.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm-protos.h
trunk/gcc/config/arm/arm.c
trunk/gcc/config/arm/arm.md
trunk/gcc/config/arm/constraints.md


[Bug tree-optimization/61682] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-07-05 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61682

Andi Kleen  changed:

   What|Removed |Added

 CC||andi-gcc at firstfloor dot org

--- Comment #5 from Andi Kleen  ---
There may be more bugs in this area.

For LTO builds depending how the compiler inlines there are several "may be
uniniitialized" errors in wide-int.h. Each of them could be a similar problem.


[Bug c++/61721] New: GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread cand at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

Bug ID: 61721
   Summary: GCC 4.8-4.10 miscompiles webkit hashing
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cand at gmx dot com

GCC 4.8.3 and 4.10 trunk@212302 tested, both broken. According to
https://bugreports.qt-project.org/browse/QTBUG-31988 this is a regression and
worked in 4.7, but I cannot confirm that as 4.7 can't build current webkit.

Building webkit with current GCC and -O2 or above miscompiles the
hashmap/hashtable hashMemory function and perhaps other parts, causing crashes
in multiple places. -O1 works fine, as does adding -fno-inline or
-fno-strict-aliasing to -O2 or -O3.

The affected files produce no warnings with -Wall -Wextra. Attaching
preprocessed source from both failing (-O2) and working (-O2 -fno-inline)
cases.

Valgrind output from the failing case:

==5710== Use of uninitialised value of size 8
==5710==at 0x15395A6: void
std::swap(WebCore::StorageAreaImpl*&,
WebCore::StorageAreaImpl*&) (move.h:175)
==5710==by 0x153965A:
WTF::RefPtr::operator=(WTF::RefPtr
const&) (RefPtr.h:109)
==5710==by 0x153BC32:
WTF::HashTableAddResult,
WTF::KeyValuePair,
WTF::RefPtr >,
WTF::KeyValuePairKeyExtractor,
WTF::RefPtr > >, WebCore::SecurityOriginHash,
WTF::KeyValuePairHashTraits
>, WTF::HashTraits > >,
WTF::HashTraits > > >
WTF::HashTable,
WTF::KeyValuePair,
WTF::RefPtr >,
WTF::KeyValuePairKeyExtractor,
WTF::RefPtr > >, WebCore::SecurityOriginHash,
WTF::KeyValuePairHashTraits
>, WTF::HashTraits > >,
WTF::HashTraits >
>::add
>, WTF::HashTraits > >,
WebCore::SecurityOriginHash>, WTF::RefPtr const&,
WTF::RefPtr&>(WTF::RefPtr
const&, WTF::RefPtr&) (HashTable.h:858)
==5710==by 0x153BD19:
WTF::HashTableAddResult,
WTF::KeyValuePair,
WTF::RefPtr >,
WTF::KeyValuePairKeyExtractor,
WTF::RefPtr > >, WebCore::SecurityOriginHash,
WTF::KeyValuePairHashTraits
>, WTF::HashTraits > >,
WTF::HashTraits > > >
WTF::HashMap,
WTF::RefPtr, WebCore::SecurityOriginHash,
WTF::HashTraits >,
WTF::HashTraits >
>::inlineAdd&>(WTF::RefPtr
const&, WTF::RefPtr&) (RefPtrHashMap.h:207)
==5710==by 0x153BD50:
WTF::HashTableAddResult,
WTF::KeyValuePair,
WTF::RefPtr >,
WTF::KeyValuePairKeyExtractor,
WTF::RefPtr > >, WebCore::SecurityOriginHash,
WTF::KeyValuePairHashTraits
>, WTF::HashTraits > >,
WTF::HashTraits > > >
WTF::HashMap,
WTF::RefPtr, WebCore::SecurityOriginHash,
WTF::HashTraits >,
WTF::HashTraits >
>::set&>(WTF::RefPtr
const&, WTF::RefPtr&) (RefPtrHashMap.h:221)
==5710==by 0x153BE7F:
WebCore::StorageNamespaceImpl::storageArea(WTF::PassRefPtr)
(StorageNamespaceImpl.cpp:134)
==5710==by 0x51DFB1: WebCore::DOMWindow::sessionStorage(int&) const (in
testapp)
==5710==by 0x12F60A1: WebCore::jsDOMWindowSessionStorage(JSC::ExecState*,
JSC::JSObject*, long, JSC::PropertyName) (in testapp)
==5710==by 0xD54049: JSC::JSValue::get(JSC::ExecState*, JSC::PropertyName,
JSC::PropertySlot&) const (in testapp)
==5710==by 0x1B79FE3: llint_slow_path_get_by_id (in testapp)
==5710==by 0x1B7240A: ??? (in testapp)
==5710==by 0x1B75747: ??? (in testapp)
==5710==  Uninitialised value was created by a stack allocation
==5710==at 0x1539270:
WebCore::SecurityOriginHash::hash(WTF::RefPtr const&)
(SecurityOriginHash.h:50)

The code from SecurityOriginHash:
static unsigned hash(SecurityOrigin* origin)
{
unsigned hashCodes[3] = {
origin->protocol().impl() ? origin->protocol().impl()->hash() : 0,
origin->host().impl() ? origin->host().impl()->hash() : 0,
origin->port()
};
return StringHasher::hashMemory(hashCodes);
}

There is no way hashCodes[] could be uninitialized. This issue does not
manifest on VS and clang, but it could still be some bug in webkit too.


[Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread cand at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

--- Comment #1 from Lauri Kasanen  ---
Created attachment 33073
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33073&action=edit
Failing preprocessed source from 4.10-git


[Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread cand at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

--- Comment #2 from Lauri Kasanen  ---
Created attachment 33074
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33074&action=edit
Working case from 4.10-git (-fno-inline)


[Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread cand at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

--- Comment #3 from Lauri Kasanen  ---
$ g++ -v
Using built-in specs.
COLLECT_GCC=/tmp/install/bin/g++
COLLECT_LTO_WRAPPER=/tmp/install/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/tmp/install --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --with-system-zlib --enable-languages=c,c++
--disable-bootstrap
Thread model: posix
gcc version 4.10.0 20140705 (experimental) (GCC)

Full build command used:
/tmp/install/bin/g++ -c -o storage/StorageNamespaceImpl.o -march=nocona -pipe
-fomit-frame-pointer -I .. -I . -I ../WTF -std=gnu++11 -DBUILDING_FLTK__
-D_GLIBCXX_USE_SCHED_YIELD -D_GLIBCXX_USE_NANOSLEEP -I/opt/icu/include 
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libxml2
-I/usr/include/harfbuzz -I/usr/X11R7/include/pixman-1 -I/usr/X11R7/include  
-I/opt/fltk13/include -I/usr/include/freetype2 -march=nocona -pipe
-fomit-frame-pointer -fno-rtti -fno-exceptions -I/usr/X11R7/include
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -I
Modules/battery -I Modules/encryptedmedia -I Modules/gamepad -I
Modules/geolocation -I Modules/indexeddb -I Modules/indexeddb/leveldb -I
Modules/indieui -I Modules/mediacontrols/ -I Modules/mediasource -I
Modules/mediastream -I Modules/navigatorcontentutils -I Modules/notifications
-I Modules/plugins -I Modules/proximity -I Modules/quota -I Modules/vibration
-I Modules/webaudio -I Modules/webdatabase -I Modules/websockets -I
accessibility -I bindings -I bindings/generic -I bindings/js -I bridge -I
bridge/c -I bridge/jsc -I crypto -I crypto/keys -I css -I cssjit -I dom -I
dom/default -I editing -I fileapi -I history -I html -I html/canvas -I
html/forms -I html/parser -I html/shadow -I html/track -I inspector -I loader
-I loader/appcache -I loader/archive -I loader/archive/mhtml -I loader/cache -I
loader/icon -I mathml -I page -I page/animation -I page/scrolling -I platform
-I platform/animation -I platform/audio -I platform/graphics -I
platform/graphics/cpu/arm -I platform/graphics/cpu/arm/filters -I
platform/graphics/filters -I platform/graphics/filters/texmap -I
platform/graphics/harfbuzz -I platform/graphics/harfbuzz/ng -I
platform/graphics/opentype -I platform/graphics/texmap -I
platform/graphics/transforms -I platform/image-decoders -I
platform/image-decoders/bmp -I platform/image-decoders/gif -I
platform/image-decoders/ico -I platform/image-decoders/jpeg -I
platform/image-decoders/png -I platform/image-decoders/webp -I platform/leveldb
-I platform/mediastream -I platform/mock -I platform/network -I platform/sql -I
platform/text -I platform/text/icu -I plugins -I rendering -I rendering/line -I
rendering/mathml -I rendering/shapes -I rendering/style -I rendering/svg -I
replay -I storage -I style -I svg -I svg/animation -I svg/graphics -I
svg/graphics/filters -I svg/properties -I websockets -I workers -I xml -I
xml/parser -I ../JavaScriptCore -I ../JavaScriptCore/ForwardingHeaders -I
../JavaScriptCore/API -I ../JavaScriptCore/assembler -I
../JavaScriptCore/bytecode -I ../JavaScriptCore/bytecompiler -I
../JavaScriptCore/dfg -I ../JavaScriptCore/disassembler -I
../JavaScriptCore/heap -I ../JavaScriptCore/debugger -I
../JavaScriptCore/interpreter -I ../JavaScriptCore/jit -I
../JavaScriptCore/llint -I ../JavaScriptCore/parser -I
../JavaScriptCore/profiler -I ../JavaScriptCore/runtime -I
../JavaScriptCore/yarr -I ForwardingHeaders -I platform/cairo -I
platform/graphics/cairo -I platform/graphics/freetype -I platform/linux -I
platform/network/curl -I platform/text/icu  -DENABLE_CANVAS_PATH 
-DENABLE_CHANNEL_MESSAGING  -DENABLE_CONTEXT_MENUS 
-DENABLE_CSS_BOX_DECORATION_BREAK 
-DENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED  -DENABLE_DETAILS_ELEMENT 
-DENABLE_FTPDIR  -DENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING 
-DENABLE_ICONDATABASE  -DENABLE_IMAGE_DECODER_DOWN_SAMPLING  -DENABLE_INSPECTOR
 -DENABLE_JIT  -DENABLE_LEGACY_VENDOR_PREFIXES  -DENABLE_LINK_PREFETCH 
-DENABLE_LLINT  -DENABLE_METER_ELEMENT  -DENABLE_NAVIGATOR_HWCONCURRENCY 
-DENABLE_PROMISES  -DENABLE_PROGRESS_ELEMENT  -DENABLE_SVG_FONTS 
-DENABLE_TEMPLATE_ELEMENT  -DENABLE_WEB_SOCKETS  -DENABLE_XSLT 
-DENABLE_SUBPIXEL_LAYOUT  -DENABLE_VIEW_MODE_CSS_MEDIA  -DENABLE_CURSOR_SUPPORT
 -DENABLE_DRAG_SUPPORT  -DENABLE_MATHML  -DENABLE_TEXT_CARET 
-DENABLE_TEXT_SELECTION  -DENABLE_WILL_REVEAL_EDGE_EVENTS 
-DWTF_USE_TEXTURE_MAPPER  -DWTF_USE_CROSS_PLATFORM_CONTEXT_MENUS
-DENABLE_NETSCAPE_PLUGIN_API=0 -DENABLE_SQL_DATABASE=0
-DENABLE_DATE_AND_TIME_INPUT_TYPES=0 -ffunction-sections -fdata-sections
-fno-rtti -fno-exceptions storage/StorageNamespaceImpl.cpp -g -save-temps -O2


[Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #4 from Markus Trippelsdorf  ---
>From https://gcc.gnu.org/bugs/ :
... if compiling with -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations makes a difference, your code probably is
not correct.

And you state that adding -fno-strict-aliasing solves the issue.
So this is most likely not a compiler issue.

(you can try to build Webkit with gcc-4.10 and -fsanitize=undefined and
see what it reports at runtime.)


[Bug rtl-optimization/61722] New: [ 4.9 ] gcc sometimes does not optimise movaps with movups

2014-07-05 Thread pietrek.j at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61722

Bug ID: 61722
   Summary: [ 4.9 ] gcc sometimes does not optimise movaps with
movups
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pietrek.j at gmail dot com

I have two functions that use unaligned moving of __m128 ( instruction movups
).
The first one is optimized well, but in the second function gcc does not
eliminate unneeded movaps in the while loop.
Code:
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));

void __test_fill_1( __m128 *dst, __m128 v, int count )
{
while ( count-- )
   {
   __builtin_ia32_storeups((float*)(dst++),v);
   __builtin_ia32_storeups((float*)(dst++),v);
   }
}

void __test_fill_2( __m128 *dst, long long _v, int count )
{
__m128 v;
((long long*)&v)[0]=((long long*)&v)[1]=_v;
while ( count-- )
   {
   __builtin_ia32_storeups((float*)(dst++),v);
   __builtin_ia32_storeups((float*)(dst++),v);
   }
}

Compilation:
$ gcc -O3 test_fill.c -o test_fill -S
$ cat test_fill
.file   "test_fill.c"
.section.text.unlikely,"ax",@progbits
.LCOLDB0:
.text
.LHOTB0:
.p2align 4,,15
.globl  __test_fill_1
.type   __test_fill_1, @function
__test_fill_1: < first function, optimisation works well here
.LFB0:
.cfi_startproc
testl   %esi, %esi
je  .L1
subl$1, %esi
leaq16(%rdi), %rax
salq$5, %rsi
leaq48(%rdi,%rsi), %rdx
.p2align 4,,10
.p2align 3
.L3:  v--- well-optimized while loop
movups  %xmm0, -16(%rax)
addq$32, %rax
movups  %xmm0, -32(%rax)
cmpq%rdx, %rax
jne .L3
.L1:
rep ret
.cfi_endproc
.LFE0:
.size   __test_fill_1, .-__test_fill_1
.section.text.unlikely
.LCOLDE0:
.text
.LHOTE0:
.section.text.unlikely
.LCOLDB1:
.text
.LHOTB1:
.p2align 4,,15
.globl  __test_fill_2
.type   __test_fill_2, @function
__test_fill_2: < second function, problem with optimizing while
loop
.LFB1:
.cfi_startproc
testl   %edx, %edx
movq%rsi, -16(%rsp)
movq%rsi, -24(%rsp)
je  .L7
subl$1, %edx
leaq16(%rdi), %rax
salq$5, %rdx
leaq48(%rdi,%rdx), %rdx
.p2align 4,,10
.p2align 3
.L9:
movaps  -24(%rsp), %xmm0 < why movaps here?
addq$32, %rax
movups  %xmm0, -48(%rax)
movaps  -24(%rsp), %xmm1 < why movaps here?
movups  %xmm1, -32(%rax)
cmpq%rdx, %rax
jne .L9
.L7:
rep ret
.cfi_endproc
.LFE1:
.size   __test_fill_2, .-__test_fill_2
.section.text.unlikely
.LCOLDE1:
.text
.LHOTE1:
.ident  "GCC: (GNU) 4.9.0 20140604 (prerelease)"
.section.note.GNU-stack,"",@progbits


[Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread cand at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

--- Comment #5 from Lauri Kasanen  ---
A -fsanitize=undefined built binary does not print anything. I understand it
can't catch all undefined behavior?

What is more interesting that adding -fsanitize=undefined to a failing case
makes it work, changing nothing else. So it too affects the optimizer somehow.


[Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing

2014-07-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61721

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #6 from Marek Polacek  ---
(In reply to Lauri Kasanen from comment #5)
> A -fsanitize=undefined built binary does not print anything. I understand it
> can't catch all undefined behavior?

Correct.

> What is more interesting that adding -fsanitize=undefined to a failing case
> makes it work, changing nothing else. So it too affects the optimizer
> somehow.

It could be the case that added instrumentation code disabled some kind of
optimization that broke the behavior.


[Bug c++/61723] New: [C++11] ICE in contains_struct_check

2014-07-05 Thread ppluzhnikov at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61723

Bug ID: 61723
   Summary: [C++11] ICE in contains_struct_check
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ppluzhnikov at google dot com

Google ref: b/16030670.

AFAICT, this is broken in all of 4.7 / 4.8 / 4.9 / 4.10.
Accepted by Clang without warnings.

gcc-svn-r212277/bin/g++ -c -std=c++11 t.cc
t.cc: In function ‘void fn1()’:
t.cc:29:14: internal compiler error: Segmentation fault
 spec.dim = { };
  ^
0xb8527f crash_signal
../../gcc/toplev.c:337
0x557b81 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/tree.h:2844
0x557b81 convert_like_real
../../gcc/cp/call.c:6257
0x554eab build_over_call
../../gcc/cp/call.c:7162
0x55800b convert_like_real
../../gcc/cp/call.c:6160
0x55799b convert_like_real
../../gcc/cp/call.c:6290
0x554eab build_over_call
../../gcc/cp/call.c:7162
0x56785c build_new_op_1
../../gcc/cp/call.c:5513
0x567c4e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*,
tree_node*, tree_node**, int)
../../gcc/cp/call.c:5674
0x6a6aeb cp_build_modify_expr(tree_node*, tree_code, tree_node*, int)
../../gcc/cp/typeck.c:7399
0x669632 cp_parser_assignment_expression
../../gcc/cp/parser.c:8216
0x66b8a3 cp_parser_expression
../../gcc/cp/parser.c:8342
0x66c0cc cp_parser_expression
../../gcc/cp/parser.c:8381
0x66c0cc cp_parser_expression_statement
../../gcc/cp/parser.c:9720
0x660e98 cp_parser_statement
../../gcc/cp/parser.c:9571
0x661ca9 cp_parser_statement_seq_opt
../../gcc/cp/parser.c:9843
0x661e16 cp_parser_compound_statement
../../gcc/cp/parser.c:9797
0x67319b cp_parser_function_body
../../gcc/cp/parser.c:18872
0x67319b cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:18908
0x679883 cp_parser_function_definition_after_declarator
../../gcc/cp/parser.c:23044
Please submit a full bug report,
with preprocessed source if appropriate.


gcc-svn-r212277/bin/g++ -c -std=c++11 t.cc -DBUG1
t.cc: In function ‘void fn1()’:
t.cc:26:1: error: non-trivial conversion at assignment
 fn1 ()
 ^
int
const int[0:18446744073709551615] *
D.2173._M_len = &._0;
t.cc:26:1: internal compiler error: verify_gimple failed
0xbb49ff verify_gimple_in_seq(gimple_statement_base*)
../../gcc/tree-cfg.c:4665
0x9cb6c1 gimplify_body(tree_node*, bool)
../../gcc/gimplify.c:8848
0x9cba26 gimplify_function_tree(tree_node*)
../../gcc/gimplify.c:8933
0x84be17 analyze_function
../../gcc/cgraphunit.c:650
0x84d01f analyze_functions
../../gcc/cgraphunit.c:1028
0x84e8e5 finalize_compilation_unit()
../../gcc/cgraphunit.c:2331
0x63b07e cp_write_global_declarations()
../../gcc/cp/decl2.c:4652
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


// -- cut ---
namespace std {
  template < class > struct initializer_list
  {
#if BUG1
int _M_len;
#endif
const int *begin ();
const int *end ();
  };
}

struct J
{
J (const int &);
template < typename InputIterator > J (InputIterator, InputIterator);
J (std::initializer_list < int >p1):J (p1.begin (), p1.end ()) { }
};

struct L
{
L ():dim (0) { }
J dim;
};

void
fn1 ()
{
L spec;
spec.dim = { };
}
// --- cut ---

[Bug bootstrap/61679] build fails with G++ 4.5.1 - prototype for hash_table does not match any in class

2014-07-05 Thread tsaunders at mozilla dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61679

--- Comment #1 from Trevor Saunders  ---
The following patch compiles with 4.9 for me, but I don't have easy
access to a machine with 4.5 on it, would you mind testing if it works
for you?

diff --git a/gcc/hash-table.h b/gcc/hash-table.h
index 22af12f..2356f8d 100644
--- a/gcc/hash-table.h
+++ b/gcc/hash-table.h
@@ -663,7 +663,7 @@ hash_table::~hash_table ()
HASH is the hash value for the element to be inserted.  */

 template class Allocator>
-typename Descriptor::value_type **
+typename hash_table::value_type **
 hash_table
 ::find_empty_slot_for_expand (hashval_t hash)
 {
@@ -803,7 +803,7 @@ hash_table::clear_slot
(value_type **slot)
be used to insert or delete an element. */

 template class Allocator>
-typename Descriptor::value_type *
+typename hash_table::value_type *
 hash_table
 ::find_with_hash (const compare_type *comparable, hashval_t hash)
 {


[Bug tree-optimization/61724] New: Some loops not vectorised

2014-07-05 Thread dzidzitop at vfemail dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61724

Bug ID: 61724
   Summary: Some loops not vectorised
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dzidzitop at vfemail dot net

Created attachment 33075
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33075&action=edit
Test code

Some loops inside C++ classes are not vectorised by the tree-vectorise driver.
Attached is an example. In it, the pairs {A::f(), A::h()} and {A::g(), A::k()}
are twins, with subtle differences in how they are implemented:
- A::f() uses condition on this->size; A::g() reads this->size into the
register variable n
- A::g() reads data from this->y (std::unique_ptr); A::k() copies the same
pointer to a local T * variable.

In both cases only the loop within the second pair member is vectorised.
Here is the compiler output.

$ g++ -std=c++11 -fPIC -O3 -ftree-vectorizer-verbose=6 test.cpp 

Analyzing loop at test.cpp:44

44: versioning for alias required: can't determine dependence between
*D.24505_63 and *D.24502_62
44: mark for run-time aliasing test between *D.24505_63 and *D.24502_62
44: Vectorizing an unaligned access.
44: Vectorizing an unaligned access.
44: vect_model_load_cost: unaligned supported by hardware.
44: vect_model_load_cost: inside_cost = 2, outside_cost = 0 .
44: vect_model_store_cost: unaligned supported by hardware.
44: vect_model_store_cost: inside_cost = 2, outside_cost = 0 .
44: cost model: Adding cost of checks for loop versioning aliasing.

44: cost model: epilogue peel iters set to vf/2 because loop iterations are
unknown .
44: Cost model analysis: 
  Vector inside of loop cost: 4
  Vector outside of loop cost: 26
  Scalar iteration cost: 2
  Scalar outside cost: 1
  prologue iterations: 0
  epilogue iterations: 8
  Calculated minimum iters for profitability: 14

44:   Profitability threshold = 15


Vectorizing loop at test.cpp:44

44: Profitability threshold is 15 loop iterations.
44: create runtime check for data references *D.24505_63 and *D.24502_62
44: created 1 versioning for alias checks.

44: LOOP VECTORIZED.
Analyzing loop at test.cpp:22

22: versioning for alias required: can't determine dependence between
*D.24457_38 and *D.24458_37
22: mark for run-time aliasing test between *D.24457_38 and *D.24458_37
22: Vectorizing an unaligned access.
22: Vectorizing an unaligned access.
22: vect_model_load_cost: unaligned supported by hardware.
22: vect_model_load_cost: inside_cost = 2, outside_cost = 0 .
22: vect_model_store_cost: unaligned supported by hardware.
22: vect_model_store_cost: inside_cost = 2, outside_cost = 0 .
22: cost model: Adding cost of checks for loop versioning aliasing.

22: cost model: epilogue peel iters set to vf/2 because loop iterations are
unknown .
22: Cost model analysis: 
  Vector inside of loop cost: 4
  Vector outside of loop cost: 26
  Scalar iteration cost: 2
  Scalar outside cost: 1
  prologue iterations: 0
  epilogue iterations: 8
  Calculated minimum iters for profitability: 14

22:   Profitability threshold = 15


Vectorizing loop at test.cpp:22

22: Profitability threshold is 15 loop iterations.
22: create runtime check for data references *D.24457_38 and *D.24458_37
22: created 1 versioning for alias checks.

22: LOOP VECTORIZED.
Analyzing loop at test.cpp:34

34: not vectorized: not suitable for gather D.24489_53 = *D.24485_52;

Analyzing loop at test.cpp:12

12: not vectorized: number of iterations cannot be computed.
test.cpp:49: note: vectorized 2 loops in function.


[Bug tree-optimization/61724] Some loops not vectorised

2014-07-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61724

--- Comment #1 from Andrew Pinski  ---
Most likely aliasing is getting in the way.


[Bug middle-end/61725] New: [4.9 Regression] __builtin_ffs(0) leads to bad code generation

2014-07-05 Thread jtaylor.debian at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61725

Bug ID: 61725
   Summary: [4.9 Regression] __builtin_ffs(0) leads to bad code
generation
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jtaylor.debian at googlemail dot com

__builtin_ffs is well defined for 0 according to the gcc documentation:

Returns one plus the index of the least significant 1-bit of x, or if x is
zero, returns zero.

yet for following program gcc 4.9 and gcc-4.10 20140627 optimizes away the
conditional on the result value for zero inputs.


#include 

int main(int argc, char *argv[])
{
int x;
for (x = -128; x <= 128; x++) {
int a = __builtin_ffs(x);
if (x == 0 && a != 0)
printf("%#x: %u\n", x, a); 
}   
return 0;
}

gcc test.c -O2
./a.out
# this should not print:
0: 0


disassembly:


  10:83 c3 01 add$0x1,%ebx
  13:81 fb 81 00 00 00cmp$0x81,%ebx
  19:74 26je 41 
  1b:0f bc d3 bsf%ebx,%edx
  1e:0f 44 d5 cmove  %ebp,%edx
  21:83 c2 01 add$0x1,%edx
  24:85 dbtest   %ebx,%ebx    test on ebx
but not edx
  26:75 e8jne10 

  28:31 f6xor%esi,%esi
  2a:31 c0xor%eax,%eax
  2c:bf 00 00 00 00   mov$0x0,%edi
  31:83 c3 01 add$0x1,%ebx
  34:e8 00 00 00 00   callq  39 
  39:81 fb 81 00 00 00cmp$0x81,%ebx

/tmp$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/tmp/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --enable-languages=c --disable-bootstrap --prefix
/tmp/gcc CFLAGS='-g3 -O0' CXXFLAGS='-g3 -O0'
Thread model: posix
gcc version 4.10.0 20140627 (experimental) (GCC) 

gcc 4.8.2 appears to work fine


[Bug bootstrap/61679] build fails with G++ 4.5.1 - prototype for hash_table does not match any in class

2014-07-05 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61679

--- Comment #2 from Gary Funck  ---
(In reply to Trevor Saunders from comment #1)
> The following patch compiles with 4.9 for me, but I don't have easy
> access to a machine with 4.5 on it, would you mind testing if it works
> for you?

Applied the patch to r212302 (2014-07-04), however, still seeing compilation
failure:


/a/gcc-4.5.1/bld/rls/bin/g++ -c  -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND
-DIN_GCC_FRONTEND -O0 -g3 -DIN_GCC-fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual
-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I.
-I. -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc
-I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/.
-I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../include
-I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libcpp/include 
-I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libdecnumber
-I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libdecnumber/bid
-I../libdecnumber -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libbacktrace   
-o attribs.o -MT attribs.o -MMD -MP -MF ./.deps/attribs.TPo
/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/attribs.c
In file included from /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/attribs.c:35:0:
/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/hash-table.h:845:1: error: prototype
for ‘typename Descriptor::value_type** hash_table::find_slot_with_hash(hash_table::compare_type*, hashval_t, insert_option)’ does not match any in class
‘hash_table’
/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/hash-table.h:542:16: error: candidate
is: hash_table::value_type**
hash_table::find_slot_with_hash(hash_table::compare_type*, hashval_t, insert_option)
/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/hash-table.h:927:1: error: prototype
for ‘void hash_table::traverse_noresize(Argument)’ does not match any in class
‘hash_table’
[...]

[Bug bootstrap/61679] build fails with G++ 4.5.1 - prototype for hash_table does not match any in class

2014-07-05 Thread tsaunders at mozilla dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61679

--- Comment #3 from Trevor Saunders  ---
> (In reply to Trevor Saunders from comment #1)
> > The following patch compiles with 4.9 for me, but I don't have easy
> > access to a machine with 4.5 on it, would you mind testing if it works
> > for you?
> 
> Applied the patch to r212302 (2014-07-04), however, still seeing compilation
> failure:

Well, you didn't mention those errors in the original description, so I
didn't try and fix them.  Is the below list complete? I'd expect to see
errors for the partial specialization for true as well.

> /a/gcc-4.5.1/bld/rls/bin/g++ -c  -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND
> -DIN_GCC_FRONTEND -O0 -g3 -DIN_GCC-fno-exceptions -fno-rtti
> -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual
> -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long
> -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I.
> -I. -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc
> -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/.
> -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../include
> -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libcpp/include 
> -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libdecnumber
> -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libdecnumber/bid
> -I../libdecnumber -I/eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/../libbacktrace  
>  
> -o attribs.o -MT attribs.o -MMD -MP -MF ./.deps/attribs.TPo
> /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/attribs.c
> In file included from /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/attribs.c:35:0:
> /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/hash-table.h:845:1: error: prototype
> for ‘typename Descriptor::value_type** hash_table false>::find_slot_with_hash(hash_table false>::compare_type*, hashval_t, insert_option)’ does not match any in class
> ‘hash_table’
> /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/hash-table.h:542:16: error: candidate
> is: hash_table::value_type**
> hash_table false>::find_slot_with_hash(hash_table false>::compare_type*, hashval_t, insert_option)

You can probably fix this one in the same way as the previous ones.

> /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/hash-table.h:927:1: error: prototype
> for ‘void hash_table false>::traverse_noresize(Argument)’ does not match any in class
> ‘hash_table’
> [...]

maybe the same sort of thing will work for this one too, but its hard to
know when the messages are cut off.

Trev

[Bug bootstrap/61679] build fails with G++ 4.5.1 - prototype for hash_table does not match any in class

2014-07-05 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61679

--- Comment #4 from Gary Funck  ---
Created attachment 33076
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33076&action=edit
make log after trying patch


[Bug bootstrap/61679] build fails with G++ 4.5.1 - prototype for hash_table does not match any in class

2014-07-05 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61679

--- Comment #5 from Gary Funck  ---
(In reply to Trevor Saunders from comment #3)
> Is the below list complete? I'd expect to see
> errors for the partial specialization for true as well.

Attached the full make log.