[Bug c/83736] New: ICE triggered by improper use of VLA and scanf

2018-01-08 Thread czirkos.zoltan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83736

Bug ID: 83736
   Summary: ICE triggered by improper use of VLA and scanf
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: czirkos.zoltan at gmail dot com
  Target Milestone: ---

Created attachment 43059
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43059&action=edit
Compiler output

The following code causes an internal compiler error and segmentation fault in
the compiler:

#include 

int main(void){
int n = 0;
char temp[n + 1];
scanf("%s", &temp);
}

Of course the code is invalid (the address-of operator is not needed), but it
should not cause an ICE.

Attached compiler output.

Version is "gcc version 7.0.1 20170407 (experimental) [trunk revision 246759]
(Ubuntu 7-20170407-0ubuntu2)".
Command line is "gcc test.c".

The compiler also crashes if the call is not scanf but printf. And it also
crashes when all warnings are turned off (gcc -w).

[Bug c++/79917] New: Internal compiler error with variadic template and concepts, internal compiler error: in tsubst_constraint, at cp/constraint.cc:1956

2017-03-06 Thread czirkos.zoltan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79917

Bug ID: 79917
   Summary: Internal compiler error with variadic template and
concepts, internal compiler error: in
tsubst_constraint, at cp/constraint.cc:1956
   Product: gcc
   Version: c++-concepts
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: czirkos.zoltan at gmail dot com
  Target Milestone: ---

Created attachment 40894
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40894&action=edit
minimal working example

G++ throws an internal compiler error for the following code (attached)

G++ version: g++ (Ubuntu 7-20170303-0ubuntu2) 7.0.1 20170303 (experimental)
[trunk revision 245860].

template 
concept bool Integral() {
return std::is_integral::value;
}

template 
void f (ARGS ... indices)
{
}

class C {
public:
template 
void operator() (ARGS ... indices)
{
}
};

int main() {
f(0, 0);

C obj;
obj(0, 0);
}

The global function works correctly, the method with the same template
arguments  crashes the compiler. Output is:


gpp_bugrep.cpp: In substitution of ‘template  requires
(Integral)()... void C::operator()(ARGS ...) [with ARGS = {int, int}]’:
gpp_bugrep.cpp:25:13:   required from here
gpp_bugrep.cpp:16:14: internal compiler error: in tsubst_constraint, at
cp/constraint.cc:1956
 void operator() (ARGS ... indices)
  ^~~~
0x6e8d7d tsubst_constraint(tree_node*, tree_node*, int, tree_node*)
../../src/gcc/cp/constraint.cc:1956
0x6e8e29 tsubst_constraint_info(tree_node*, tree_node*, int, tree_node*)
../../src/gcc/cp/constraint.cc:1918
0x5f6bef tsubst_decl
../../src/gcc/cp/pt.c:12346
0x5e33af tsubst(tree_node*, tree_node*, int, tree_node*)
../../src/gcc/cp/pt.c:13310
0x5e287b instantiate_template_1
../../src/gcc/cp/pt.c:18131
0x5e287b instantiate_template(tree_node*, tree_node*, int)
../../src/gcc/cp/pt.c:18187
0x5fb628 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../src/gcc/cp/pt.c:18567
0x5adbd7 add_template_candidate_real
../../src/gcc/cp/call.c:3170
0x5a5594 add_template_candidate
../../src/gcc/cp/call.c:3252
0x5a5594 add_candidates
../../src/gcc/cp/call.c:5483
0x5b0062 build_op_call_1
../../src/gcc/cp/call.c:4456
0x5b0062 build_op_call(tree_node*, vec**, int)
../../src/gcc/cp/call.c:4550
0x68eba7 finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../src/gcc/cp/semantics.c:2458
0x64293c cp_parser_postfix_expression
../../src/gcc/cp/parser.c:6991
0x64326d cp_parser_unary_expression
../../src/gcc/cp/parser.c:8102
0x643fd3 cp_parser_cast_expression
../../src/gcc/cp/parser.c:8780
0x644747 cp_parser_binary_expression
../../src/gcc/cp/parser.c:8881
0x644df4 cp_parser_assignment_expression
../../src/gcc/cp/parser.c:9168
0x647f6a cp_parser_expression
../../src/gcc/cp/parser.c:9337
0x64c908 cp_parser_expression_statement
../../src/gcc/cp/parser.c:10885