[Bug middle-end/55030] [4.8 Regression]: gcc.c-torture/execute/builtins/memcpy-chk.c execution, -Os (et al)

2013-06-08 Thread ebotcazou at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55030

--- Comment #18 from Eric Botcazou ebotcazou at gcc dot gnu.org ---
 FWIW, I've bootstrapped and regtested gcc 4.9 with r192676 reapplied and the
 dse.c and cselib.c hunks of r193802 reverted on several hosts (x86_64,
 sparc64, powerpc64, armv5tel, m68k) without regressions.

Let's just reapply r192676 on the mainline.  We just need to make sure that the
failures on i686 don't reappear.


[Bug lto/57334] [4.9 regression] ICE: in input_gimple_stmt, at gimple-streamer-in.c:287

2013-06-08 Thread dimhen at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57334

Dmitry G. Dyachenko dimhen at gmail dot com changed:

   What|Removed |Added

Summary|ICE: in input_gimple_stmt,  |[4.9 regression] ICE: in
   |at gimple-streamer-in.c:287 |input_gimple_stmt, at
   ||gimple-streamer-in.c:287

--- Comment #4 from Dmitry G. Dyachenko dimhen at gmail dot com ---
r198736 PASS
r198741 FAIL
r199835 FAIL

r198741 | hubicka | 2013-05-09 19:37:12 +0400 (Thu, 09 May 2013) | 18 lines
Changed paths:
   M /trunk/gcc/ChangeLog
   M /trunk/gcc/lto/ChangeLog
   M /trunk/gcc/lto/lto-partition.c
   M /trunk/gcc/lto/lto-partition.h
   M /trunk/gcc/lto/lto.c
   M /trunk/gcc/symtab.c


Jan Hubicka  j...@suse.cz
Richard Biener  rguent...@suse.de

PR lto/54095
* symtab.c (symtab_make_decl_local): Do not add private names.

* lto.c (lto_register_var_decl_in_symtab): Don't do renaming.
(lto_register_var_decl_in_symtab): Likewise.
(lto_main): Promote statics.
* lto-partition.c (privatize_symbol_name): New function.
(promote_symbol): Use it.
(may_need_named_section_p): New predicate.
(rename_statics): New functions.
(lto_promote_cross_file_statics): Simplify; do renaming.
(lto_promote_statics_nonwpa): New function.
* lto-partition.h (lto_promote_statics_nonwpa): New function.


[Bug c++/57565] variadic template and type inference failure

2013-06-08 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57565

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #3 from Paolo Carlini paolo.carlini at oracle dot com ---
Thanks Jon! Now that I see the problem reduced I agree it doesn't seem
familiar, some fallback errors in the original testcase misled me. Pretty
annoying bug anyway, let's add Jason in CC, in case he is ineterested in the
short term or has cues.


[Bug fortran/57553] Valid use of STORAGE_SIZE rejected, bad error message for invalid use

2013-06-08 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57553

--- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org ---
Author: burnus
Date: Sat Jun  8 12:21:58 2013
New Revision: 199850

URL: http://gcc.gnu.org/viewcvs?rev=199850root=gccview=rev
Log:
2013-06-08  Tobias Burnus  bur...@net-b.de

PR fortran/57553
* simplify.c (gfc_simplify_storage_size): Handle literal
strings.
* trans-intrinsic.c (gfc_conv_intrinsic_storage_size):
Add missing fold_convert.

2013-06-08  Tobias Burnus  bur...@net-b.de

PR fortran/57553
* gfortran.dg/storage_size_4.f90: New.


Added:
trunk/gcc/testsuite/gfortran.dg/storage_size_4.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/simplify.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/57553] Valid use of STORAGE_SIZE rejected, bad error message for invalid use

2013-06-08 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57553

--- Comment #3 from Tobias Burnus burnus at gcc dot gnu.org ---
The rejects-valid and the ICE-on-valid-code issue has been solved.


TODO: The following message for invalid code should be improved. [The problem
is that storage_size cannot handle a, which is required for a constant
expression.]

integer, parameter :: ESize = ( storage_size(a) + 7 ) / 8
1
  Error: Unclassifiable statement at (1)


[Bug fortran/37336] Fortran 2003: Finish derived-type finalization

2013-06-08 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336

--- Comment #25 from Tobias Burnus burnus at gcc dot gnu.org ---
Author: burnus
Date: Sat Jun  8 12:26:40 2013
New Revision: 199851

URL: http://gcc.gnu.org/viewcvs?rev=199851root=gccview=rev
Log:
2013-06-08  Tobias Burnus  bur...@net-b.de

PR fortran/37336
* trans-decl.c (init_intent_out_dt): Call finalizer
when approriate.

2013-06-08  Tobias Burnus  bur...@net-b.de

PR fortran/37336
* gfortran.dg/finalize_10.f90: New.
* gfortran.dg/auto_dealloc_2.f90: Update tree-dump.
* gfortran.dg/finalize_15.f90: New.


Added:
trunk/gcc/testsuite/gfortran.dg/finalize_10.f90
trunk/gcc/testsuite/gfortran.dg/finalize_15.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/auto_dealloc_2.f90


[Bug c/55383] -Wcast-qual reports incorrect message

2013-06-08 Thread gerald at pfeifer dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55383

--- Comment #2 from Gerald Pfeifer gerald at pfeifer dot com ---
Hi Manuel, I also got pinged by a FreeBSD user of one of my ports
about this.

Somehow I cannot find your patch submission on gcc-patches -- is it
possible you haven't submitted it there yet?  Will you be doing that,
or is it fine if I do?


[Bug c++/57172] [C++11][DR 1164] Template overload resolution ambiguous for T versus T

2013-06-08 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57172

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-06-08
 Ever confirmed|0   |1


[Bug c++/57543] decltype needs explicit 'this' pointer in member function declaration of template class with trailing return type

2013-06-08 Thread daniel.kruegler at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57543

Daniel Krügler daniel.kruegler at googlemail dot com changed:

   What|Removed |Added

 CC||daniel.kruegler@googlemail.
   ||com

--- Comment #1 from Daniel Krügler daniel.kruegler at googlemail dot com ---
This problem still exists for gcc 4.9.0 20130519 (experimental)

[Bug c++/57524] internal compiler error on dump translation unit

2013-06-08 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57524

Marc Glisse glisse at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed|2013-06-05 00:00:00 |2013-06-08
 Ever confirmed|0   |1
  Known to fail||4.7.3, 4.8.0

--- Comment #9 from Marc Glisse glisse at gcc dot gnu.org ---
Calling cc1plus directly, I can reproduce with trunk. The failing assert in
timevar.c is:

  /* Don't allow the same timing variable to be started more than
 once.  */
  gcc_assert (!tv-standalone);


/usr/include/boost/variant/detail/hash_variant.hpp:33:24: internal compiler
error: in timevar_start, at timevar.c:343
0xcce161 timevar_start(timevar_id_t)
/data/repos/gcc/trunk/gcc/timevar.c:343
0x7cfa85 push_using_directive
/data/repos/gcc/trunk/gcc/cp/name-lookup.c:5652
0x7cfa34 push_using_directive_1
/data/repos/gcc/trunk/gcc/cp/name-lookup.c:5641
0x7cfa91 push_using_directive
/data/repos/gcc/trunk/gcc/cp/name-lookup.c:5653
0x7ca70e do_using_directive(tree_node*)
/data/repos/gcc/trunk/gcc/cp/name-lookup.c:3933
0x7ca7a7 parse_using_directive(tree_node*, tree_node*)
/data/repos/gcc/trunk/gcc/cp/name-lookup.c:3957
0x6ddce4 cp_parser_using_directive
/data/repos/gcc/trunk/gcc/cp/parser.c:15732
0x6d5ceb cp_parser_block_declaration
/data/repos/gcc/trunk/gcc/cp/parser.c:10670
0x6d53df cp_parser_declaration_statement
/data/repos/gcc/trunk/gcc/cp/parser.c:10344
0x6d2e33 cp_parser_statement
/data/repos/gcc/trunk/gcc/cp/parser.c:9107
0x6d371b cp_parser_statement_seq_opt
/data/repos/gcc/trunk/gcc/cp/parser.c:9379
0x6d361e cp_parser_compound_statement
/data/repos/gcc/trunk/gcc/cp/parser.c:9333
0x6e1e23 cp_parser_function_body
/data/repos/gcc/trunk/gcc/cp/parser.c:18066
0x6e20b0 cp_parser_ctor_initializer_opt_and_function_body
/data/repos/gcc/trunk/gcc/cp/parser.c:18102
0x6e8f28 cp_parser_function_definition_after_declarator
/data/repos/gcc/trunk/gcc/cp/parser.c:22080
0x6eab72 cp_parser_late_parsing_for_member
/data/repos/gcc/trunk/gcc/cp/parser.c:22730
0x6e36cc cp_parser_class_specifier_1
/data/repos/gcc/trunk/gcc/cp/parser.c:18825
0x6e3795 cp_parser_class_specifier
/data/repos/gcc/trunk/gcc/cp/parser.c:18849
0x6da899 cp_parser_type_specifier
/data/repos/gcc/trunk/gcc/cp/parser.c:13861
0x6d66b4 cp_parser_decl_specifier_seq
/data/repos/gcc/trunk/gcc/cp/parser.c:11152


[Bug tree-optimization/57567] New: Missed optimsation : compare + or

2013-06-08 Thread j...@bass-software.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57567

Bug ID: 57567
   Summary: Missed optimsation : compare + or
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: j...@bass-software.com

Using 4.9.0 20130608 (experimental) [trunk revision 199851], target
arm-unknown-eabi.

The following case produces suboptimal code:

unsigned
test (unsigned t)
{
  if (t != (unsigned)-1)
t |= 3;
  return t;
}

Result:

cmnr0, #1
orrner0, r0, #3

A simple:

orrr0, r0, #3

would be enough.


[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-08 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555

--- Comment #4 from Marc Glisse glisse at gcc dot gnu.org ---
The warning is correct, but it is arguably unhelpful in this case, which is
made worse by the fact that -Woverflow is enabled by default. We do not warn
for 
  uint8_t ret = 0;
  ret += ~foo;
with -Wall -Wextra, which is quite similar.

Changing this behavior would be hard, since when we emit the warning we have
forgotten where the constant was coming from.

bar doesn't warn because the constant would fit the signed type corresponding
to uint8_t (int8_t), a heuristic to reduce the noise produced by this warning.


[Bug rtl-optimization/57468] [4.9 Regression] 26% performance drop on important benchmark after r199298.

2013-06-08 Thread izamyatin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57468

--- Comment #3 from Igor Zamyatin izamyatin at gmail dot com ---
Patch is here http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00357.html


[Bug c/55383] -Wcast-qual reports incorrect message

2013-06-08 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55383

--- Comment #3 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Gerald Pfeifer from comment #2)
 Somehow I cannot find your patch submission on gcc-patches -- is it
 possible you haven't submitted it there yet?  Will you be doing that,
 or is it fine if I do?

I don't remember what happened with this patch. Please feel free to adopt it if
it works. Thanks for taking care of it.

[Bug rtl-optimization/57468] [4.9 Regression] 26% performance drop on important benchmark after r199298.

2013-06-08 Thread izamyatin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57468

--- Comment #4 from Igor Zamyatin izamyatin at gmail dot com ---
So following commit fixed the issue

commit 3620f4de1b49b0bfffe5f812b2d259e5c72c5c61
Author: vmakarov vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Thu Jun 6 21:12:06 2013 +

2013-06-06  Vladimir Makarov  vmaka...@redhat.com

PR rtl-optimization/57468
* config/i386/i386.c (inline_secondary_memory_needed): Ignore
spilled pseudos.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199764
138bc75d-0d04-0410-961f-82ee72b054a4


[Bug c/57563] Lots of Cilk+ failures on i686-linux

2013-06-08 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57563

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-06-08
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek mpolacek at gcc dot gnu.org ---
I see that too.


[Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os

2013-06-08 Thread dhazeghi at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57568

Bug ID: 57568
   Summary: wrong code for assignment in conditional at -Os
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dhazeghi at yahoo dot com

The following code is miscompiled by gcc trunk and 4.8 on x86_64-linux at -Os
and above optimization levels in 32-bit mode (should print nothing).  This is a
regression from 4.7.x.

$ gcc-trunk -v
gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) 
$ gcc-trunk -O1 -m32 reduced.c 
$ ./a.out 
$ gcc-4.7 -Os -m32 reduced.c 
$ ./a.out 
$ gcc-trunk -Os -m32 reduced.c 
$ ./a.out 
1
$
---
int printf (const char *, ...);

int a[6][9] = {};
int b = 1;
int *c = a[3][5];

int main ()
{
  if (b)
if (*c = *c + *c)
  printf (%d\n, a[3][5]);

  return 0;
}


[Bug rtl-optimization/57569] New: wrong code for struct copy at -O3 on x86_64-linux

2013-06-08 Thread dhazeghi at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57569

Bug ID: 57569
   Summary: wrong code for struct copy at -O3 on x86_64-linux
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dhazeghi at yahoo dot com

The following code is miscompiled with current gcc-trunk on x86_64-linux at -O3
optimization level in 32-bit mode, outputting garbage (rather than 0).  This is
a regression from 4.7.

$ gcc-trunk -v
gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) 
$ gcc-trunk -O2 -m32 reduced.c 
$ ./a.out 
0
$ gcc-4.7 -O3 -m32 reduced.c 
$ ./a.out 
0
$ gcc-trunk -O3 -m32 reduced.c 
$ ./a.out 
134519796

int printf (const char *, ...);

struct S { int f0; } a; 

int b, e, *d = b, f;

void 
fn1 ()
{
  int **g[9][6];
  int ***h = g[6][3];
  for (; e  9; e++) {
f = 0;
for (; f  6; f++)
  g[e][f] = d;
  }
  ***h = 0;
}

void
fn2 ()
{
  fn1 ();
  struct S c[4][10] = {};
  a = c[3][9];
}

int
main ()
{
  fn2 ();
  printf (%d\n, a.f0);
  return 0;
}


[Bug c++/57509] Segmentation fault when using __builtin_shuffle in templated class.

2013-06-08 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57509

Marc Glisse glisse at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-06-08
 Ever confirmed|0   |1

--- Comment #2 from Marc Glisse glisse at gcc dot gnu.org ---
(In reply to Paolo Carlini from comment #1)
 Maybe Marc is interested in this.

ChangeLog says this is probably my fault...

c_build_vec_perm_expr is missing some code like we can find in build_x_unary_op
for instance:

  if (processing_template_decl)
{
  if (type_dependent_expression_p (xarg))
return build_min_nt_loc (loc, code, xarg, NULL_TREE);

  xarg = build_non_dependent_expr (xarg);
}

RID_BUILTIN_SHUFFLE is handled very early in parser.c which directly calls
c_build_vec_perm_expr. I guess we could use build_min_nt(VEC_PERM_EXPR,...) to
store the template version, and make sure that c_build_vec_perm_expr is called
once the types are instantiated (in tsubst_copy(_and_build)?).


[Bug middle-end/48784] #pragma pack(1) + -fstrict-volatile-bitfields = bad codegen

2013-06-08 Thread sandra at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48784

--- Comment #2 from Sandra Loosemore sandra at codesourcery dot com ---
I'm working on a fix for this.


[Bug middle-end/23623] volatile keyword changes bitfield access size from 32bit to 8bit

2013-06-08 Thread sandra at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23623

Sandra Loosemore sandra at codesourcery dot com changed:

   What|Removed |Added

 CC||sandra at codesourcery dot com

--- Comment #15 from Sandra Loosemore sandra at codesourcery dot com ---
This bug regressed sometime around GCC 4.7, when the C++ bitfield range support
was added.  I'm working on a fix that makes it work again in conjunction with
-fstrict-volatile-bitfields.


[Bug target/56997] Incorrect write to packed field when strict-volatile-bitfields enabled on aarch32

2013-06-08 Thread sandra at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56997

Sandra Loosemore sandra at codesourcery dot com changed:

   What|Removed |Added

 CC||sandra at codesourcery dot com

--- Comment #4 from Sandra Loosemore sandra at codesourcery dot com ---
I'm working on a fix for this.


[Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os

2013-06-08 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57568

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2013-06-08
 CC||jakub at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
   Target Milestone|--- |4.8.2
Summary|wrong code for assignment   |[4.8/4.9 Regression] wrong
   |in conditional at -Os   |code for assignment in
   ||conditional at -Os
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org ---
Started with r188785, but guess it has just been latent before that.


[Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os

2013-06-08 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57568

--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org ---
Created attachment 30280
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30280action=edit
gcc49-pr57568.patch

Untested fix.


[Bug rtl-optimization/57569] [4.8/4.9 Regression] wrong code for struct copy at -O3 on x86_64-linux

2013-06-08 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57569

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-06-08
 CC||jakub at gcc dot gnu.org,
   ||matz at gcc dot gnu.org
   Target Milestone|--- |4.8.2
Summary|wrong code for struct copy  |[4.8/4.9 Regression] wrong
   |at -O3 on x86_64-linux  |code for struct copy at -O3
   ||on x86_64-linux
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org ---
Started with r188667.


[Bug c++/57509] Segmentation fault when using __builtin_shuffle in templated class.

2013-06-08 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57509

--- Comment #3 from Paolo Carlini paolo.carlini at oracle dot com ---
Thanks Marc. Please take your own plan very seriously! ;)


[Bug c++/57509] Segmentation fault when using __builtin_shuffle in templated class.

2013-06-08 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57509

--- Comment #4 from Marc Glisse glisse at gcc dot gnu.org ---
Created attachment 30281
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30281action=edit
Untested patch

There are quite a few issues with the c++ version...


[Bug fortran/50554] INQUIRE cannot redefine DO index (r178939)

2013-06-08 Thread tkoenig at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50554

Thomas Koenig tkoenig at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |tkoenig at gcc dot 
gnu.org


[Bug c++/57570] New: Deduction succeeds despite type mismatch of non-type template parameter and deduced argument

2013-06-08 Thread hstong at ca dot ibm.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57570

Bug ID: 57570
   Summary: Deduction succeeds despite type mismatch of non-type
template parameter and deduced argument
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hstong at ca dot ibm.com

GCC does not consistently fail deduction for type mismatch of a non-type
template parameter and the corresponding deduced argument.

See N3690 subclause 14.8.2.5 [temp.deduct.type] paragraph 17.

### STANDALONE SOURCE:
template short, char struct A;

int foo(void *);
template short x int foo(Ax, x *ap)
   // neither clang++ nor g++ bother to look at the second instance of x
   // for deduction
{ return noGood(ap); }

int bar(void *);
template char y int bar(Ay, y *ap)
   // okay; clang++ and g++ both realize that deducing from the first instance
   // of y is no good
{ return noGood(ap); }

int zip(void *, void *);
template short x, char y int zip(Ax, y *ap, Ay, x *)
   // clang++ does not bother to look at the second function argument
   // for deduction, g++ does
{ return noGood(ap); }

A0, 0 *ap = 0;

int a = foo(ap);  // clang++ and g++ both fail to fail the argument deduction
int b = bar(ap);  // clang++ and g++ both successfully fail the deduction
int c = zip(ap, ap);  //
   // clang++ fails to fail and g++ successfully fails the argument deduction

// For all three:
// - MSVC 17.00.51025 fails to fail the argument deduction
// - ICC 13.0.1 20121010 and IBM XL C/C++ for AIX 12.1.0.3 work fine


### COMPILER INVOCATION:
g++ -std=c++11 -c main.cpp


### EXPECTED OUTPUT:
Successful compile.


### ACTUAL OUTPUT:
main.cpp: In instantiation of 'int foo(Ax, x*) [with short int x = 0]':
main.cpp:23:15:   required from here
main.cpp:7:12: error: 'noGood' was not declared in this scope


### g++ -v OUTPUT:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --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.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64 --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.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04)