[Bug c++/57891] New: No diagnostic of narrowing conversion in non-type template argument

2013-07-12 Thread imkinghan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57891

Bug ID: 57891
   Summary: No diagnostic of narrowing conversion in non-type
template argument
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: imkinghan at gmail dot com

In the following C++11 program:

template
struct A{};

int main()
{
A<1-2> a;
(void)a;
return 0;
}

the declaration of `a` requires a narrowing conversion to be diagnosed per 
C++11 Standard § 14.3.2/5:

>For a non-type template-parameter of integral or enumeration type, conversions 
>permitted in a converted constant expression (5.19) are applied.

and § 5.19/3:

>A converted constant expression of type T is a literal constant expression, 
>implicitly converted to type T, where the implicit conversion (if any) is 
>permitted in a literal constant expression and the implicit conversion sequence
>contains only user-defined conversions, lvalue-to-rvalue conversions (4.1), 
>integral promotions (4.5), and integral conversions (4.7) other than narrowing 
>conversions (8.5.4)

No diagnostic is forthcoming (-std-c++11;-Wall). The same narrowing conversion,
from -1 to `unsigned`, is diagnosed (with a warning) in other contexts where
the Standard prohibits the narrowing conversion, e.g.

unsigned int ui = { -1 };

A compiler that diagnoses the narrowing conversion of a non-type template
argument (clang 3.2/3.3 makes it an error) will pinpoint a TMP bug in which
an unsigned template argument falls recursively through 0, while g++ will just
exceed `-ftemplate-depth`.

This report stems from my Stackoverflow question
http://stackoverflow.com/q/17559165/1362568

[Bug c++/29834] g++ thinks it is a declaration when it cannot be

2013-07-12 Thread ace.of.zerosync at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29834

--- Comment #13 from M.S. Babaei  ---
(In reply to James Kanze from comment #9)
> Re using the init list syntax: it won't work if you have to be compatible
> with other compilers (like Sun CC).  Using something like (Doh (x)), ++x
> seems to be the most portable work-around.

Sorry, I didn't get your answer at first sight. Actually your elegant
workaround is the most portable way. And, works on all compilers, too. Even
pre-C++11 era compilers.

Thanks.


[Bug other/46333] problems with configure -enable-build-with-cxx -disable-bootstrap

2013-07-12 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46333

--- Comment #22 from Marc Glisse  ---
Did someone try to bootstrap gcc using CC=suncc CXX='sunCC -library=stlport4'
recently? Is this PR still relevant?


[Bug rtl-optimization/57878] Incorrect code: live register clobbered in split2

2013-07-12 Thread eraman at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57878

--- Comment #2 from Easwaran Raman  ---
After IRA, we have:

(insn 116 115 117 6 (set (reg:DI 130 [ D.3288 ])
(mem:DI (plus:SI (reg/v/f:SI 172 [orig:109 __first ] [109])
(const_int 4 [0x4])) [10 MEM[base: _1, index: _44, offset: 0]+0
S8 A64])) r.ii:197 88 {*movdi_internal}
 (expr_list:REG_EQUIV (mem:DI (plus:SI (reg/v/f:SI 172 [orig:109 __first ]
[109])
(const_int 4 [0x4])) [10 MEM[base: _1, index: _44, offset: 0]+0
S8 A64])
(nil)))
(insn 117 116 118 6 (parallel [
(set (reg/f:SI 138 [ D.3281 ])
(minus:SI (reg/v/f:SI 173 [orig:110 __cur ] [110])
(reg/v/f:SI 103 [ __cur ])))
(clobber (reg:CC 17 flags))
]) 309 {*subsi_1}
 (expr_list:REG_UNUSED (reg:CC 17 flags)
(nil)))
(insn 118 117 119 6 (parallel [
(set (reg/f:SI 140 [ D.3282 ])
(plus:SI (reg/v/f:SI 103 [ __cur ])
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 273 {*addsi_1}
 (expr_list:REG_UNUSED (reg:CC 17 flags)
(nil)))
(insn 119 118 120 6 (set (mem:DI (plus:SI (reg/v/f:SI 173 [orig:110 __cur ]
[110])
(const_int 4 [0x4])) [10 MEM[base: _75, index: _77, offset:
0B]+0 S8 A64])
(reg:DI 130 [ D.3288 ])) r.ii:197 88 {*movdi_internal}
 (expr_list:REG_DEAD (reg:DI 130 [ D.3288 ])
(nil)))
(insn 120 119 121 6 (set (reg:DI 131 [ D.3287 ])
(mem:DI (plus:SI (plus:SI (reg/f:SI 99 [ D.3281 ])
(reg/f:SI 126 [ D.3282 ]))
(const_int 8 [0x8])) [10 MEM[base: _1, index: _44, offset: 8]+0
S8 A64])) r.ii:197 88 {*movdi_internal}
 (expr_list:REG_EQUIV (mem:DI (plus:SI (plus:SI (reg/f:SI 99 [ D.3281 ])
(reg/f:SI 126 [ D.3282 ]))
(const_int 8 [0x8])) [10 MEM[base: _1, index: _44, offset: 8]+0
S8 A64])
(nil)))
(insn 121 120 122 6 (set (mem:DI (plus:SI (plus:SI (reg/f:SI 138 [ D.3281 ])
(reg/f:SI 140 [ D.3282 ]))
(const_int 8 [0x8])) [10 MEM[base: _75, index: _77, offset:
8B]+0 S8 A64])
(reg:DI 131 [ D.3287 ])) r.ii:197 88 {*movdi_internal}
 (expr_list:REG_DEAD (reg:DI 131 [ D.3287 ])
(nil)))


After reload,
 1. insn 116 is deleted
 2. In insn 117, the pseudo 138 is replaced with dx
 3. dx is spilled into stack at offset -0x36 from bp.
 4. For insn 119, first a new pseudo 193 is created which is equivalent to 130
and is loaded from memory. This 193 is in DI mode and is replaced by ax. This
would clobber edx, but that is ok since dx is now stored into stack at offset
-0x36.
 5. This is followed by the the store of 193 (ax) into memory location.
 6. Then dx is loaded from bp-0x36.
 7. insn 120 is deleted
 8. For insn 121, the pseudo 131 is replaced by 196 which is assigned the hard
reg ax. 

In the sequence above, shouldn't the fill of dx from bp-0x36 at step 6 above
happen after step 8?


[Bug middle-end/56417] internal compiler error: verify_gimple failed

2013-07-12 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56417

Marek Polacek  changed:

   What|Removed |Added

 Status|WAITING |NEW
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |4.8.2
  Known to fail||4.8.1, 4.9.0

--- Comment #4 from Marek Polacek  ---
Yeah, confirmed.


[Bug c/57889] Improvement: builtin to return a string from a type (type to string builtin)

2013-07-12 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57889

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
__builtin_typename would be a better name I suspect.


[Bug target/57890] gcc 4.8.1 regression: loops become slower

2013-07-12 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57890

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
  Component|c++ |target
   Severity|major   |normal

--- Comment #1 from Andrew Pinski  ---
That would mean the expansion for memset is not optimal for the target which
means this is a target issue rather than a C++ front-end or a middle-end issue.


[Bug c++/57890] New: gcc 4.8.1 regression: loops become slower

2013-07-12 Thread dushistov at mail dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57890

Bug ID: 57890
   Summary: gcc 4.8.1 regression: loops become slower
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dushistov at mail dot ru

$cat what_test.cpp
char c[100];

void f(void)
{
for(int i=0; i < 100; ++i)
c[i] = '0';
}

I run this test with:
cat test.cpp
#include 

extern void f();

int main()
{
for (size_t i = 0; i < 1; ++i)
f();
}

compile with "-march=native -O3" on (i7 64bit mode).

Here is result:
for test_loop47 we get average 0.348000
for test_loop481 we get average 0.40

If compare generated code then on 4.7 "f" function is transformed to:
push   %rbp
vmovdqa 0x107(%rip),%ymm0
movb   $0x30,0x200aa0(%rip)
movb   $0x30,0x200a9a(%rip)
mov%rsp,%rbp
vmovdqa %ymm0,0x200a2e(%rip)
...

on gcc 4.8.1:

movabs $0x3030303030303030,%rax
movl   $0x30303030,0x200a9c(%rip)
mov%rax,0x200a35(%rip)
mov%rax,0x200a36(%rip)
...


PS

I just checked may be 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55953
fixed in gcc 4.8.1,
and yes it indeed "fixed", instead of optimal for loops and
not optimal for builtin_memset it now produces not the same not optimal code
for both cases.


[Bug target/57717] error: unrecognizable insn compiling ./strtod_l.c from glibc on powerpc-gnuspe

2013-07-12 Thread alexandru.sardan at freescale dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717

Alexandru-Cezar Sărdan  changed:

   What|Removed |Added

 CC||alexandru.sardan@freescale.
   ||com

--- Comment #5 from Alexandru-Cezar Sărdan  ---
Created attachment 30500
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30500&action=edit
testcase

The attached test case causes another ICE if gcc is compiled for gnuspe targets
after the patch proposed in comment #4 is applied and -mfloat-gprs=double is
used.
Also -mfloat-gprs=single works fine.

$ ./gcc/cc1 -m32 -mcpu=8548 -mabi=spe -mspe -mfloat-gprs=double ~/test.c 
 __bswap_32 __bswap_64 create_Result_file main
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data>   <*free_inline_summary>
Assembling functions:
 create_Result_file
/home/alex/test.c: In function 'create_Result_file':
/home/alex/test.c:43:1: internal compiler error: in change_address_1, at
emit-rtl.c:2019
 }
 ^

[Bug c/57889] New: Improvement: builtin to return a string from a type (type to string builtin)

2013-07-12 Thread yann at droneaud dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57889

Bug ID: 57889
   Summary: Improvement: builtin to return a string from a type
(type to string builtin)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yann at droneaud dot fr

Hi,

It might be of interest to have a builtin to convert a type name to a string.
Given a type or a variable, the builtin would return the type of it as a
string.
It could be used to build debug messages:


#define ASSERT_NULL(p) do { \
 if ((p) == NULL)   \
printf("%s * %s == NULL\n", __builtin_typestringof(*p), #p); \
} while(0);

Regards.


[Bug middle-end/55771] Negation and type conversion incorrectly exchanged

2013-07-12 Thread matz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55771

Michael Matz  changed:

   What|Removed |Added

 CC||matz at gcc dot gnu.org

--- Comment #12 from Michael Matz  ---
*** Bug 57886 has been marked as a duplicate of this bug. ***


[Bug middle-end/57886] Invalid folding of (float)-x to -(float)x

2013-07-12 Thread matz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57886

Michael Matz  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Michael Matz  ---
Indeed.

*** This bug has been marked as a duplicate of bug 55771 ***


[Bug middle-end/57886] Invalid folding of (float)-x to -(float)x

2013-07-12 Thread mikpe at it dot uu.se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57886

--- Comment #1 from Mikael Pettersson  ---
Dup of PR55771?


[Bug c++/57888] New: using non-type template parameter in constexpr function for non static data member intializer segfaults

2013-07-12 Thread plasmahh at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57888

Bug ID: 57888
   Summary: using non-type template parameter in constexpr
function for non static data member intializer
segfaults
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: plasmahh at gmx dot net

While trying to find workaronuds for Bug #57887 I tried the following code:

struct B
{
template
struct A
{
constexpr int get_N() { return N; }

//  int X = N;
int X = get_N();
void foo( )
{
int x = N;
}
};
};

Which made gcc segfault. Whatever the validity of #57887 is, I don't think it
should segfault here...


[Bug libitm/57855] passing unsafe function as transaction_safe function pointer does not generate error

2013-07-12 Thread patrick.marlier at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57855

Patrick Marlier  changed:

   What|Removed |Added

 CC||patrick.marlier at gmail dot 
com

--- Comment #2 from Patrick Marlier  ---
There was a related discussion here:
http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00598.html
Probably we can modify Dave's patch a bit.


[Bug c++/57887] New: nested non-type template parameters not declared in this scope

2013-07-12 Thread plasmahh at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57887

Bug ID: 57887
   Summary: nested non-type template parameters not declared in
this scope
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: plasmahh at gmx dot net

Hi, when trying to compile the following:

struct B
{
template
struct A
{
int X = N;
};
};

I get the error: 
g.cxx:6:11: error: 'N' was not declared in this scope

Things work fine when I make X a static const(expr), or when I move A outside
B. The above code however works fine within clang, and I could not find any
wording that would make N suddenly not being available within A, especially
since when you add teh following member function to A (but remove X), it
compiles fine:

void foo( ) { int x = N; }

so it /somehow/ is in scope.


[Bug middle-end/57886] New: Invalid folding of (float)-x to -(float)x

2013-07-12 Thread matz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57886

Bug ID: 57886
   Summary: Invalid folding of (float)-x to -(float)x
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: matz at gcc dot gnu.org

Came up in IRC, GCC invalidly moves a conversion innerwards:

% cat x.c
extern void abort (void);
float global;
int main()
{
  unsigned long z = 1;
  float x = -z;
  global = x;
  if (global < 0)
abort ();
  return 0;
}
% gcc x.c && ./a.out
Aborted

This is because GCC transforms the initializer of x (float)-z, into
-(float)z, even though z is an unsigned int.  -z is always positive, but
due to this x will be -1.


[Bug middle-end/56417] internal compiler error: verify_gimple failed

2013-07-12 Thread dcb314 at hotmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56417

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #3 from David Binderman  ---
Still seems to be broken with 20130710.

An additional test case is available on request.


[Bug middle-end/57393] [4.9 Regression] error: definition in block 4 follows the use / internal compiler error: verify_ssa failed

2013-07-12 Thread dcb314 at hotmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57393

--- Comment #8 from David Binderman  ---
Still fails on 20130710. 

Another test case that generates the same message is available on request.


[Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic ignored "-Wundef"

2013-07-12 Thread nomegenerico at email dot it
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

Fabio  changed:

   What|Removed |Added

 CC||nomegenerico at email dot it

--- Comment #3 from Fabio  ---
Same BUG in MinGW (version shipped with the Qt5.1 framework)

> gcc --version
gcc (rev2, Built by MinGW-builds project) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.