[Bug c++/93143] New: Multiple calls to static constexpr member function gives wrong code

2020-01-03 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143

Bug ID: 93143
   Summary: Multiple calls to static constexpr member function
gives wrong code
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 47586
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47586&action=edit
Source showing problem.

This is with g++ (GCC) 10.0.0 20200102 (experimental), on x86_64.

Compile the attached source with:

g++ -std=gnu++17 v8.cpp

When running it aborts, but should not.
(it is the second abort that triggers.)

If the single line in v6_type() is commented out, the example program stops
aborting.

Seems to be some interaction compile time/run time wrt constexpr.

[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code

2020-01-07 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143

--- Comment #1 from Lars Gullik Bjønnes  ---
Forgot to mention that it works nicely with GCC 9.

[Bug c++/93250] New: [10 Regression] ICE: in sign_mask, at wide-int.h:855

2020-01-13 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93250

Bug ID: 93250
   Summary: [10 Regression] ICE: in sign_mask, at wide-int.h:855
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 47644
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47644&action=edit
Source showing the ICE

g++ (GCC) 10.0.0 20200111 (experimental) (from new git repo: cff5a23148)

Compiling the attached source gives:

g++ -std=gnu++17 -c v10.cpp 
v10.cpp: In member function ‘long unsigned int a::c()’:
v10.cpp:6:30: internal compiler error: in sign_mask, at wide-int.h:855
6 | unsigned long a ::c() { d >> b; }
  |  ^
0x5f8c42 generic_wide_int >::sign_mask()
const
../../gcc/gcc/wide-int.h:855
0x5f922a generic_wide_int >::sign_mask()
const
../../gcc/gcc/tree.c:7373
0x5f922a bool wi::neg_p >
>(generic_wide_int > const&, signop)
../../gcc/gcc/wide-int.h:1836
0x5f922a tree_int_cst_sgn(tree_node const*)
../../gcc/gcc/tree.c:7386
0x77bdb1 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
../../gcc/gcc/cp/typeck.c:5609
0x627f3b build_new_op_1
../../gcc/gcc/cp/call.c:6475
0x62886d build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
../../gcc/gcc/cp/call.c:6520
0x773146 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
../../gcc/gcc/cp/typeck.c:4245
0x6db3bd cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9648
0x6dbf27 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:9783
0x6dc1b2 cp_parser_expression
../../gcc/gcc/cp/parser.c:9951
0x6defc8 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:11602
0x6e96e3 cp_parser_statement
../../gcc/gcc/cp/parser.c:11398
0x6eadb8 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11745
0x6eae70 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11699
0x700590 cp_parser_function_body
../../gcc/gcc/cp/parser.c:22901
0x700590 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:22952
0x703b0d cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:28739
0x704a97 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:28655
0x704a97 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:20530

Compiling with GCC9 works fine. (except for one warning)

[Bug sanitizer/59307] New: ICE with boost::format and ubsan

2013-11-26 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59307

Bug ID: 59307
   Summary: ICE with boost::format and ubsan
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

Created attachment 31304
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31304&action=edit
Preprocessed file showing the ICE

With g++ (GCC) 4.9.0 20131121 (experimental) and this program:


#include 

int main()
{
boost::format f("%s");
return 0;
}


I get this ICE (shown with the preprocessed code in attachment):

g++ -std=gnu++11 -O0 --sanitize=undefined format-ice.ii
format-ice.cpp: In member function ‘bool
(boost::optional_detail::optional_base::*
boost::optional_detail::optional_base::safe_bool() const)() const [with T =
std::locale; boost::optional_detail::optional_base::unspecified_bool_type =
bool (boost::optional_detail::optional_base::*)() const;
boost::optional_detail::optional_base::this_type =
boost::optional_detail::optional_base]’:
format-ice.cpp:10:1: internal compiler error: Segmentation fault
 }
 ^
0x93c0af crash_signal
../../gcc/gcc/toplev.c:336
0xa1dbf6 get_expr_operands
../../gcc/gcc/tree-ssa-operands.c:732
0xa1e563 parse_ssa_operands
../../gcc/gcc/tree-ssa-operands.c:951
0xa1fb47 build_ssa_operands
../../gcc/gcc/tree-ssa-operands.c:966
0xa1fb47 update_stmt_operands(gimple_statement_base*)
../../gcc/gcc/tree-ssa-operands.c:1103
0x7c0bdf update_stmt_if_modified
../../gcc/gcc/gimple-ssa.h:154
0x7c0bdf update_modified_stmt
../../gcc/gcc/gimple-iterator.c:50
0x7c0bdf gsi_insert_before(gimple_stmt_iterator_d*, gimple_statement_base*,
gsi_iterator_update)
../../gcc/gcc/gimple-iterator.c:517
0x9516ad instrument_member_call
../../gcc/gcc/ubsan.c:595
0x9516ad instrument_null
../../gcc/gcc/ubsan.c:628
0xae1acb walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, pointer_set_t*, tree_node* (*)(tree_node**, int*, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*))
../../gcc/gcc/tree.c:10927
0x7cddc2 walk_gimple_op(gimple_statement_base*, tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
../../gcc/gcc/gimple-walk.c:203
0x95150a ubsan_pass
../../gcc/gcc/ubsan.c:655
0x95150a execute
../../gcc/gcc/ubsan.c:694

--sanitize=address does not give the same ICE.

Possibly related to pr59250.

[Bug sanitizer/59331] New: ubsan gives extra warnings with vla.

2013-11-28 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59331

Bug ID: 59331
   Summary: ubsan gives extra warnings with vla.
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

g++ (GCC) 4.9.0 20131128 (experimental)
Copyright (C) 2013 Free Software Foundation, Inc.
r205479

This snippet:

-
void foo(int i)
{
char a[i];
(void)a;
}
-

Compiled with: g++ -c -std=gnu++11 -Wall -fsanitize=undefined

gives this warning:

In function ‘void foo(int)’:
3:13: warning: value computed is not used [-Wunused-value]

If -fsanitize=undefined is removed, no warning is given.

[Bug sanitizer/59667] New: ubsan: ICE ubsan_type_descriptor

2014-01-03 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59667

Bug ID: 59667
   Summary: ubsan: ICE ubsan_type_descriptor
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

This is with gcc --version
gcc (GCC) 4.9.0 20140103 (experimental) as of r206313

This snippet:

void foo()  
{   
unsigned int len = 1;   
float (*P)[len][len];   
(*P)[0][0] = 1; 
}

compiled with gcc -c -fsanitize=undefined snippet.c

Gives:

snippet.c: In function ‘foo’:
snippet.c:1:6: internal compiler error: Segmentation fault
 void foo()
  ^
0x87abff crash_signal
../../gcc/gcc/toplev.c:336
0x890f2d ubsan_type_descriptor(tree_node*, bool)
../../gcc/gcc/ubsan.c:319
0x891b44 ubsan_expand_null_ifn(gimple_stmt_iterator)
../../gcc/gcc/ubsan.c:584
0x888de1 execute_sanopt
../../gcc/gcc/asan.c:2574
0x888de1 execute
../../gcc/gcc/asan.c:2624

[Bug c++/89241] New: ICE in enclosing_instantiation_of, at cp/pt.c:13380

2019-02-07 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89241

Bug ID: 89241
   Summary: ICE in enclosing_instantiation_of, at cp/pt.c:13380
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 45635
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45635&action=edit
Reduced sources showing ICE

With the attached reduced from code using Boost.Asio I get this ICE:

g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc-9/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-9/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gcc/gcc-9
--enable-checking=release --enable-languages=c,c++
Thread model: posix
gcc version 9.0.1 20190207 (experimental) (GCC)

/opt/gcc/gcc-9/bin/g++ -c bug3.cpp 
bug3.cpp: In instantiation of ‘o<  >::m_fn3() [with
 = int]:: [with auto:1 = int;
auto:2 = int]’:
bug3.cpp:4:27:   required by substitution of ‘template decltype (g(1,
2)) ag(e) [with e = o<  >::m_fn3() [with
 = int]::]’
bug3.cpp:8:7:   required from ‘void l<  >::m(al) [with
al = o<  >::m_fn3() [with  =
int]::;  = int]’
bug3.cpp:30:5:   required from ‘void o<  >::m_fn3()
[with  = int]’
bug3.cpp:33:16:   required from here
bug3.cpp:30:39: internal compiler error: in enclosing_instantiation_of, at
cp/pt.c:13380
   30 | av[0]->m_fn2().m([](auto, auto) { __PRETTY_FUNCTION__; });
  |   ^~~
0x5ccba9 enclosing_instantiation_of
../../gcc/gcc/cp/pt.c:13380
0x702ff9 tsubst_copy
../../gcc/gcc/cp/pt.c:15543
0x703a08 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19345
0x7038f6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19475
0x6ff724 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17805
0x6ff23a tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16925
0x6ff07c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17212
0x6fef08 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16911
0x6ff07c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17212
0x6ff07c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17212
0x6fde6d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16896
0x6fde6d instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:24584
0x677823 maybe_instantiate_decl
../../gcc/gcc/cp/decl2.c:5281
0x677823 maybe_instantiate_decl
../../gcc/gcc/cp/decl2.c:5265
0x678e08 mark_used(tree_node*, int)
../../gcc/gcc/cp/decl2.c:5437
0x61afde build_over_call
../../gcc/gcc/cp/call.c:8543
0x61de1e build_op_call_1
../../gcc/gcc/cp/call.c:4671
0x61de1e build_op_call(tree_node*, vec**, int)
../../gcc/gcc/cp/call.c:4700
0x72f16f finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2585
0x705cb7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18970

[Bug c++/83814] [8 Regression] ICE: in fold_binary_loc, at fold-const.c:9733

2018-01-16 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83814

--- Comment #10 from Lars Gullik Bjønnes  ---
(In reply to David Malcolm from comment #8)
> Sorry about the breakage.
> 
> Here's a candidate patch:
>   https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01133.html

This fixes the ICE for me, with the patch appleid
I am not able to reproduce the ice in comment #9 either.

gcc --version
gcc (GCC) 8.0.1 20180116 (experimental)

with the proposed patched applied.

[Bug c++/89315] New: Cannot convert to std::initializer_list - fails with gcc9 works with gcc8

2019-02-12 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89315

Bug ID: 89315
   Summary: Cannot convert to std::initializer_list - fails with
gcc9 works with gcc8
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 45675
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45675&action=edit
Soruce that works with gcc8 fails with gcc9

The attached code compiles with:

g++ --version
g++ (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)

but fails with

/opt/gcc/gcc-9/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc-9/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-9/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gcc/gcc-9
--enable-checking=release --enable-languages=c,c++

/opt/gcc/gcc-9/bin/g++ -c bug4.cpp 
bug4.cpp: In instantiation of ‘void n<  >::m_fn1()
[with  = void]’:
bug4.cpp:17:22:   required from here
bug4.cpp:13:24: error: cannot convert ‘const bar*’ to
‘std::initializer_list’
   13 | void m_fn1() { i{{}}; }
  |^
bug4.cpp:4:9: note:   initializing argument 1 of
‘bar::bar(std::initializer_list, int)’
4 | bar(std::initializer_list, int = int());
  | ^~

[Bug c++/87463] New: ICE in in tsubst_copy, at cp/pt.c:15513

2018-09-28 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87463

Bug ID: 87463
   Summary: ICE in in tsubst_copy, at cp/pt.c:15513
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 44764
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44764&action=edit
Source file showing the problem

When I compile the attached code I get this ICE:

g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc-9/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-9/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gcc/gcc-9
--enable-checking=release --enable-languages=c,c++
Thread model: posix
gcc version 9.0.0 20180925 (experimental) (GCC)

g++ -c foo.cpp
foo.cpp: In instantiation of ‘void l() [with  = int]’:
foo.cpp:17:12:   required from here
foo.cpp:12:5: internal compiler error: in tsubst_copy, at cp/pt.c:15513
12 | ""_a;
   | ^~~~
0x59e988 tsubst_copy
../../gcc/gcc/cp/pt.c:15513
0x6d083f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19039
0x6cfa0c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18309
0x6c18dc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17455
0x6c1602 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16650
0x6c0bc2 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16939
0x6db708 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16621
0x6db708 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:24099
0x6ddbd3 instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:24215
0x63fd80 c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4709

[Bug c++/87476] New: [9 Regression] char-array initialized from wide-string

2018-10-01 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87476

Bug ID: 87476
   Summary: [9 Regression] char-array initialized from wide-string
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 44771
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44771&action=edit
Source showing error

Using g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc-9/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-9/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gcc/gcc-9
--enable-checking=release --enable-languages=c,c++
Thread model: posix
gcc version 9.0.0 20180925 (experimental) (GCC)

When compiling the attached source snippet I get:

g++ -c foo.cpp
foo.cpp: In instantiation of ‘void f<  >::operator()()
[with  = int]’:
foo.cpp:9:14:   required from here
foo.cpp:4:33: error: char-array initialized from wide string
4 | constexpr unsigned char p[1]{};
  |

With g++ --version
g++ (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5)
this compiles without any errors.

[Bug c++/69970] New: Surprising warning with -Wnonnull-compare - 'this' compared to NULL

2016-02-25 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69970

Bug ID: 69970
   Summary: Surprising warning with -Wnonnull-compare - 'this'
compared to NULL
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

Compiling this snippet:

class Foo {
public:
explicit Foo(bool)
{}
};

class Bar {
public:
Bar()
: foo_(new Foo(this))
{}
private:
Foo * foo_; 
};

int main()
{
Bar bar;
return 0;
}


With:
g++ -c -Wnonnull-compare nonnull.cpp

Gives:
nonnull.cpp: In constructor ‘Bar::Bar()’:
nonnull.cpp:10:21: warning: nonnull argument ‘this’ compared to NULL
[-Wnonnull-compare]
  : foo_(new Foo(this))


Removing explict makes no difference.

g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc-6/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-6/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gcc/gcc-6
--enable-checking=release --enable-languages=c,c++,lto
Thread model: posix
gcc version 6.0.0 20160225 (experimental) (GCC)

[Bug c++/69970] Surprising warning with -Wnonnull-compare - 'this' compared to NULL

2016-02-26 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69970

--- Comment #3 from Lars Gullik Bjønnes  ---
The warning might be right, but is very unhelpful.
Also with gcc 5 I get no warning (and seeming working code).
Note that this is reduced (and thus a bit strange) from a much
larger code base.

[Bug c/70475] New: -Wmisleading-indentation quetionable in Eigen

2016-03-31 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70475

Bug ID: 70475
   Summary: -Wmisleading-indentation quetionable in Eigen
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

In Eigen (http://eigen.tuxfamily.org/index.php?title=Main_Page),
this construct is used to group things:


void do_stuff();
void do_other_stuff();

int main() {
bool a = false;

   do_other_stuff();
if (a) do_stuff();
   do_other_stuff();
};
-

Should -Wmisleading-indentation really warn on this?
To me it is pretty clear that the conditional only
apply to the one line.

[Bug libstdc++/60710] New: experimental::optional is using T::operator!=

2014-03-30 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60710

Bug ID: 60710
   Summary: experimental::optional is using T::operator!=
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net

When looking at n3793 it states that operator!= should be implemented
with !(t1 == t2), and not t1 != t2 as the implementation in gcc 4.9 is
doing. This is the case for both the operator!= implementations where
optional is compared against T.

Also since optional should not put requirements on the contained type
other than operator== and operator>, operator!= are removed from the
tests in the suggested patch.


[Bug libstdc++/60710] experimental::optional is using T::operator!=

2014-03-30 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60710

Lars Gullik Bjønnes  changed:

   What|Removed |Added

 CC||larsbj at gullik dot net

--- Comment #1 from Lars Gullik Bjønnes  ---
Created attachment 32486
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32486&action=edit
replace != with !( == ) in optional::operator!=

[Bug c++/61007] New: New strict-aliasing warnings in 4.10.0

2014-04-29 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61007

Bug ID: 61007
   Summary: New strict-aliasing warnings in 4.10.0
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net

Created attachment 32707
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32707&action=edit
gzipped preprossed code showing the problem

In current trunk I get some new strict-aliasing warnings that I did
not get with 4.9.0.

Shown when compiling attached preprocessed code with:
(the operations.ii is from boost release 1.55, boost.filesystem)

g++ -O2 -Wall -Wno-unused -std=gnu++11 -c operations.ii

...
functional/boost/libs/filesystem/src/operations.cpp:343:40: warning:
dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
 return fs::directory_iterator(p)== end_dir_itr;
^
...

$ g++ --version
g++ (GCC) 4.10.0 20140424 (experimental)


[Bug c++/61004] [4.10 Regression] Spurious warning: dereferencing type-punned pointer

2014-04-30 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61004

--- Comment #7 from Lars Gullik Bjønnes  ---
(In reply to Richard Biener from comment #6)
> Created attachment 32713 [details]
> untested patch

This fixes the problem for me, in my
application.

[Bug c++/61603] New: ICE in gcc/gcc/toplev.c:337

2014-06-25 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61603

Bug ID: 61603
   Summary: ICE in gcc/gcc/toplev.c:337
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net

Created attachment 33004
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33004&action=edit
Preprosessed file

When compiling a test file consisting of only a

  #include 

line. I get the following ICE:

g++ -c test.cc
In file included from /usr/include/boost/asio/write_at.hpp:650:0,
 from /usr/include/boost/asio.hpp:119,
 from test.cc:1:
/usr/include/boost/asio/impl/write_at.hpp:823:1: internal compiler error:
Segmentation fault
 } // namespace boost
 ^
0x9677cf crash_signal
../../gcc/gcc/toplev.c:337
0x6dbb23 insert_to_assembler_name_hash
../../gcc/gcc/symtab.c:202
0x6dbc31 symtab_initialize_asm_name_hash()
../../gcc/gcc/symtab.c:387
0x6dbd8c symtab_initialize_asm_name_hash()
../../gcc/gcc/symtab.c:411
0x6dbd8c symtab_node_for_asm(tree_node const*)
../../gcc/gcc/symtab.c:400
0x6e4c58 handle_alias_pairs
../../gcc/gcc/cgraphunit.c:1152
0x6e7e5c finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2320
0x5989ab cp_write_global_declarations()
../../gcc/gcc/cp/decl2.c:4647


This is with:
# gcc --version
gcc (GCC) 4.10.0 20140624 (experimental)


[Bug c++/59886] New: ICE in expand_expr_real_2

2014-01-20 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59886

Bug ID: 59886
   Summary: ICE in expand_expr_real_2
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net

Created attachment 31897
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31897&action=edit
Reduced preprocessed code.

g++ --version
g++ (GCC) 4.9.0 20140120 (experimental) as of rev 206794

When compiling the attached preprocessed code (somewhat reduced),
I get the following ICE:

g++ -std=gnu++11 DnsLocatorProfiles.ii
functional/protocols/dnslocator/DnsLocatorProfiles.cpp: In function ‘void
__static_initialization_and_destruction_0(int, int)’:
functional/protocols/dnslocator/DnsLocatorProfiles.cpp:58:5: internal compiler
error: in expand_expr_real_2, at expr.c:9201
 };
 ^
0x77c193 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc/gcc/expr.c:9201
0x6c122c expand_gimple_stmt_1
../../gcc/gcc/cfgexpand.c:3249
0x6c122c expand_gimple_stmt
../../gcc/gcc/cfgexpand.c:3309
0x6c18cb expand_gimple_basic_block
../../gcc/gcc/cfgexpand.c:5149
0x6c3dc6 gimple_expand_cfg
../../gcc/gcc/cfgexpand.c:5715
0x6c3dc6 execute
../../gcc/gcc/cfgexpand.c:5935

[Bug c++/59886] ICE in expand_expr_real_2

2014-01-20 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59886

Lars Gullik Bjønnes  changed:

   What|Removed |Added

 CC||bernd.edlinger at hotmail dot 
de,
   ||jakub at gcc dot gnu.org

--- Comment #1 from Lars Gullik Bjønnes  ---
Add likely suspects to Cc.

[Bug c++/59886] ICE in expand_expr_real_2

2014-01-20 Thread larsbj at gullik dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59886

--- Comment #3 from Lars Gullik Bjønnes  ---
Yes, the compiler is built with:

../gcc/configure --prefix=/opt/gcc/gcc-trunk --enable-checking=release
--enable-languages=c,c++,lto

[Bug sanitizer/68122] New: ICE in gcc/toplev.c:353 with -fsanitize=undefined and -fgnu-tm

2015-10-27 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68122

Bug ID: 68122
   Summary: ICE in gcc/toplev.c:353 with -fsanitize=undefined and
-fgnu-tm
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

This program:

int cnt = 0;

int main(void)
{
  __transaction_atomic {
cnt++;
  }
}

Gives

tm-thread.c: In function ‘main’:
tm-thread.c:8:1: internal compiler error: Segmentation fault
 }
 ^
0x98b74f crash_signal
../../gcc/gcc/toplev.c:353
0x98f8e4 is_tm_pure_call
../../gcc/gcc/trans-mem.c:275
0x98ff19 ipa_tm_scan_calls_block
../../gcc/gcc/trans-mem.c:4158
0x993653 ipa_tm_scan_calls_transaction
../../gcc/gcc/trans-mem.c:4211
0x993653 ipa_tm_execute
../../gcc/gcc/trans-mem.c:5385
0x993653 execute
../../gcc/gcc/trans-mem.c:5623

When compiled with

gcc (GCC) 6.0.0 20151022 (experimental)

[Bug sanitizer/68122] ICE in gcc/toplev.c:353 with -fsanitize=undefined and -fgnu-tm

2015-10-27 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68122

--- Comment #1 from Lars Gullik Bjønnes  ---
Command used to call:

gcc -fsanitize=undefined -fgnu-tm tm-thread.c

[Bug ipa/64218] [5 Regression] ICE: Segmentation fault (symtab_node::get_alias_target()) running Boost testsuite

2015-01-14 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64218

Lars Gullik Bjønnes  changed:

   What|Removed |Added

 CC||larsbj at gullik dot net

--- Comment #9 from Lars Gullik Bjønnes  ---
I see the same segfault also outside of the boost testsuite,
have not been able to produce a test case that is uploadable.
(without significant reduction I am not allowed to post the code.)

[Bug ipa/64314] [5 Regression] ICE in record_reference, at cgraphbuild.c:87

2015-01-14 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64314

--- Comment #2 from Lars Gullik Bjønnes  ---
I still see this, but with current gcc5 the call stack has become a bit
deeper, instead of 5 calls to walk_tree_1 I now see 9 calls.
(with -std=gnu++14 in this case.)

[Bug sanitizer/64984] New: [5 Regression] ICE in check_noexcept_t with ubsan

2015-02-09 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64984

Bug ID: 64984
   Summary: [5 Regression] ICE in check_noexcept_t with ubsan
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

With this test program I get an ICE.

--
#include 

class Type
{
public:
Type();
virtual ~Type();

bool operator<(const Type &) const;
};

int main()
{
std::map map;
map[Type()] = 0;
}


g++ --version
g++ (GCC) 5.0.0 20150203 (experimental)

g++ -fsanitize=undefined -std=gnu++11 -c test.cpp

In file included from /opt/gcc/gcc-trunk/include/c++/5.0.0/bits/move.h:57:0,
 from /opt/gcc/gcc-trunk/include/c++/5.0.0/bits/stl_pair.h:59,
 from
/opt/gcc/gcc-trunk/include/c++/5.0.0/bits/stl_algobase.h:64,
 from /opt/gcc/gcc-trunk/include/c++/5.0.0/bits/stl_tree.h:63,
 from /opt/gcc/gcc-trunk/include/c++/5.0.0/map:60,
 from test.cpp:1:
/opt/gcc/gcc-trunk/include/c++/5.0.0/type_traits: In instantiation of ‘struct
std::__is_nt_constructible_impl’:
/opt/gcc/gcc-trunk/include/c++/5.0.0/type_traits:137:12:   required from
‘struct std::__and_,
std::__is_nt_constructible_impl >’
/opt/gcc/gcc-trunk/include/c++/5.0.0/type_traits:1174:12:   required from
‘struct std::is_nothrow_constructible’
/opt/gcc/gcc-trunk/include/c++/5.0.0/type_traits:1205:12:   required from
‘struct std::__is_nothrow_move_constructible_impl’
/opt/gcc/gcc-trunk/include/c++/5.0.0/type_traits:1211:12:   required from
‘struct std::is_nothrow_move_constructible’
/opt/gcc/gcc-trunk/include/c++/5.0.0/tuple:367:7:   required from ‘constexpr
std::_Tuple_impl<_Idx, _Head>::_Tuple_impl(std::_Tuple_impl<_Idx, _Head>&&)
[with long unsigned int _Idx = 0ul; _Head = Type&&]’
/opt/gcc/gcc-trunk/include/c++/5.0.0/tuple:976:70:   required from
‘std::tuple<_Elements&& ...> std::forward_as_tuple(_Elements&& ...) [with
_Elements = {Type}]’
/opt/gcc/gcc-trunk/include/c++/5.0.0/bits/stl_map.h:500:27:   required from
‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp,
_Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare,
_Alloc>::key_type&&) [with _Key = Type; _Tp = int; _Compare = std::less;
_Alloc = std::allocator >; std::map<_Key, _Tp,
_Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare,
_Alloc>::key_type = Type]’
test.cpp:15:15:   required from here
/opt/gcc/gcc-trunk/include/c++/5.0.0/type_traits:1162:12: internal compiler
error: Segmentation fault
 struct __is_nt_constructible_impl<_Tp, _Arg>
^
0xa89c7f crash_signal
../../gcc/gcc/toplev.c:383
0x69ea1b check_noexcept_r
../../gcc/gcc/cp/except.c:1162
0xc6b254 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11086
0xc6b438 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11390
0xc6ca18 walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set*))
../../gcc/gcc/tree.c:11416
0x69e7cf expr_noexcept_p(tree_node*, int)
../../gcc/gcc/cp/except.c:1255
0x69e922 finish_noexcept_expr(tree_node*, int)
../../gcc/gcc/cp/except.c:1240
0x61e2ee tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:14880
0x61b6ab tsubst_expr
../../gcc/gcc/cp/pt.c:14383
0x61c63c tsubst_template_arg
../../gcc/gcc/cp/pt.c:9692
0x626839 tsubst_template_args
../../gcc/gcc/cp/pt.c:10242
0x623544 tsubst_aggr_type
../../gcc/gcc/cp/pt.c:10439
0x617771 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11894
0x631c69 instantiate_class_template_1
../../gcc/gcc/cp/pt.c:9260
0x631c69 instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:9673
0x68aa5d complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:146
0x68aaff complete_type_or_maybe_complain(tree_node*, tree_node*, int)
../../gcc/gcc/cp/typeck.c:158
0x608d09 xref_basetypes(tree_node*, tree_node*)
../../gcc/gcc/cp/decl.c:12493
0x63116e instantiate_class_template_1
../../gcc/gcc/cp/pt.c:9279
0x63116e instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:9673

[Bug sanitizer/64984] [5 Regression] ICE in check_noexcept_t with ubsan

2015-02-10 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64984

--- Comment #4 from Lars Gullik Bjønnes  ---
(In reply to Jakub Jelinek from comment #3)
> Created attachment 34710 [details]
> gcc5-pr64984.patch
> 
> Untested fix.

This seems to fix ICE, but I have at least one more that needs tracking down,
also related to -fsanitize=undefined, but not to -fsanitize=vptr.
(and a hang with -fsanitize=address and heap-use-after-free reporting.)

I'll create separate bugs for those.

[Bug sanitizer/65000] New: ICE in in expand_builtin_eh_common, at except.c:2072

2015-02-10 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65000

Bug ID: 65000
   Summary: ICE in in expand_builtin_eh_common, at except.c:2072
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

With this test program I get an ICE:

---
#include 

void setGateLog()
{
boost::format fmt("%%");
fmt % 1;
}
---

g++ --version
g++ (GCC) 5.0.0 20150210 (experimental) (as of revision 220578)

g++ -O1 -fsanitize=undefined -fno-sanitize-recover -c test.cpp

In file included from /usr/include/boost/format.hpp:49:0,
 from test.cpp:1:
/usr/include/boost/format/feed_args.hpp: In function ‘void
boost::io::detail::put(T, const boost::io::detail::format_item&,
typename boost::basic_format::string_type&, typename
boost::basic_format::internal_streambuf_t&,
boost::io::detail::locale_t*) [with Ch = char; Tr = std::char_traits;
Alloc = std::allocator; T = const int&; typename boost::basic_format::string_type = std::__cxx11::basic_string; typename
boost::basic_format::internal_streambuf_t =
boost::io::basic_altstringbuf,
std::allocator >; boost::io::detail::locale_t = std::locale]’:
/usr/include/boost/format/feed_args.hpp:122:10: internal compiler error: in
expand_builtin_eh_common, at except.c:2072
 void put( T x, 
  ^
0x8266d1 expand_builtin_eh_common
../../gcc/gcc/except.c:2072
0x8282df expand_builtin_eh_copy_values(tree_node*)
../../gcc/gcc/except.c:2108
0x76978a expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
../../gcc/gcc/builtins.c:6521
0x84177b expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/gcc/expr.c:10488
0x77f91c expand_expr
../../gcc/gcc/expr.h:254
0x77f91c expand_call_stmt
../../gcc/gcc/cfgexpand.c:2383
0x77f91c expand_gimple_stmt_1
../../gcc/gcc/cfgexpand.c:3327
0x77f91c expand_gimple_stmt
../../gcc/gcc/cfgexpand.c:3481
0x78374a expand_gimple_basic_block
../../gcc/gcc/cfgexpand.c:5470
0x7854c6 execute
../../gcc/gcc/cfgexpand.c:6088


Removing -fno-sanitize-recover or compiling without optimization
removes the ICE.

I can provide pre-processed source if wanted.

[Bug sanitizer/65000] ICE in in expand_builtin_eh_common, at except.c:2072

2015-02-10 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65000

--- Comment #3 from Lars Gullik Bjønnes  ---
This is a different code snippet to get what seems to be the same error:

---
#include 

int f(unsigned int datalen);

class Streambuf : public std::basic_streambuf {
private:
virtual int sync()
{
f(this->pptr() - this->pbase());
return 0;
}
};


class Stream : public std::basic_ostream {
public:
~Stream()
{
buf_.pubsync();
}
private:
Streambuf buf_;
};

void test()
{
Stream cs;
}
---

I'll add preprocessed source for that as well.

[Bug sanitizer/65000] ICE in in expand_builtin_eh_common, at except.c:2072

2015-02-10 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65000

--- Comment #4 from Lars Gullik Bjønnes  ---
Created attachment 34712
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34712&action=edit
preprocesed source for second code snippet

[Bug sanitizer/65000] ICE in in expand_builtin_eh_common, at except.c:2072

2015-02-10 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65000

--- Comment #2 from Lars Gullik Bjønnes  ---
Created attachment 34711
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34711&action=edit
preprocessed source for test code in #1

[Bug sanitizer/65000] ICE in in expand_builtin_eh_common, at except.c:2072

2015-02-10 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65000

--- Comment #7 from Lars Gullik Bjønnes  ---
Note that my last tests is done with the proposed fix for
bug 64984 applied.

[Bug sanitizer/65081] New: -fsanitize=object-size fails with simple pointer arithm

2015-02-16 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65081

Bug ID: 65081
   Summary: -fsanitize=object-size fails with simple pointer
arithm
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

With:

gcc (GCC) 5.0.0 20150216 (experimental) as of 220738

and this test snippet:

---

struct intro {
int a;
char pad_[1];
};

struct intro b;

struct intro * alloc()
{
struct intro * i = &b;
return i + 1;
}

int main(void)
{
struct intro * i = alloc() - 1;
i->a = 1;
}
---

I get this report:

test.c:17:10: runtime error: store to address 0x006010a0 with insufficient
space for an object of type 'int'
0x006010a0: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
  ^

When compiled like this:

 gcc -O1 -fsanitize=object-size test.c

-fno-inline removes the runtime error, as do removing the pad_ from the intro
struct.

This is possibly an duplicate of bug 63303, but the errors are quite different.


[Bug c++/64314] New: [5 Regression] ICE in record_reference, at cgraphbuild.c:87

2014-12-15 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64314

Bug ID: 64314
   Summary: [5 Regression] ICE in record_reference,  at
cgraphbuild.c:87
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net

Compiling this:

#include 
enum profile_type {};
struct A {
  std::string value;
};
struct {
  profile_type type;
  A strategies[1];
} a{};


with:

g++ -std=gnu++1 -c
(g++ (GCC) 5.0.0 20141215 (experimental) as of r218745)

Results in:

cc1plus: internal compiler error: in record_reference, at cgraphbuild.c:87
0x768273 record_reference
../../gcc/gcc/cgraphbuild.c:87
0xc2dda3 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11022
0xc2e105 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11219
0xc2e0a5 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11099
0xc2e0a5 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11099
0xc2e0a5 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set*))
../../gcc/gcc/tree.c:11099
0x768461 record_references_in_initializer(tree_node*, bool)
../../gcc/gcc/cgraphbuild.c:426
0xc5aede varpool_node::analyze()
../../gcc/gcc/varpool.c:534
0x76c60a analyze_functions
../../gcc/gcc/cgraphunit.c:1048
0x76ca65 symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2351
0x61102b cp_write_global_declarations()
../../gcc/gcc/cp/decl2.c:4688


Might be releated to bug 50410 and/or bug 57197


[Bug c++/61678] New: internal compiler error: in expand_expr_real_1, at expr.c:9467

2014-07-02 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61678

Bug ID: 61678
   Summary: internal compiler error: in expand_expr_real_1, at
expr.c:9467
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net

$ cat main.ii
struct Test {
Test();
};

Test::Test()
{
int w = 512;
unsigned rgb_ref[1][w];
}


Gives this error:

$ /opt/gcc/gcc-trunk/bin/g++ -c main.ii
main.ii: In constructor ‘Test::Test()’:
main.ii:8:26: internal compiler error: in expand_expr_real_1, at expr.c:9467
 unsigned rgb_ref[1][w];
  ^
0x77961b expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/gcc/expr.c:9462
0x7825e5 expand_expr
../../gcc/gcc/expr.h:451
0x7825e5 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc/gcc/expr.c:8151
0x6c542e expand_gimple_stmt_1
../../gcc/gcc/cfgexpand.c:3294
0x6c542e expand_gimple_stmt
../../gcc/gcc/cfgexpand.c:3354
0x6c656a expand_gimple_basic_block
../../gcc/gcc/cfgexpand.c:5192
0x6c8166 execute
../../gcc/gcc/cfgexpand.c:5799


This is with $ /opt/gcc/gcc-trunk/bin/g++ --version
g++ (GCC) 4.10.0 20140702 (experimental)

[Bug sanitizer/61693] New: [asan] is not intercepting aligned_alloc

2014-07-03 Thread larsbj at gullik dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61693

Bug ID: 61693
   Summary: [asan] is not intercepting aligned_alloc
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

cat aligned_alloc.c
#include 

int main(void)
{
  void * p = aligned_alloc(128, 1024);
  free(p);
}

$ gcc -std=c11 -fsanitize=address aligned_alloc.c && ./a.out 
=
==28341==ERROR: AddressSanitizer: attempting free on address which was not
malloc()-ed: 0x00728080 in thread T0
#0 0x7fa78060d2d7 in __interceptor_free
../../../../gcc/libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x40077e in main (/home/lgb/Development/test/a.out+0x40077e)
#2 0x31c0821d64 in __libc_start_main (/lib64/libc.so.6+0x31c0821d64)
#3 0x400688 (/home/lgb/Development/test/a.out+0x400688)

AddressSanitizer can not describe address in more detail (wild memory access
suspected).
SUMMARY: AddressSanitizer: bad-free
../../../../gcc/libsanitizer/asan/asan_malloc_linux.cc:62 __interceptor_free
==28341==ABORTING


AFAICS the asan interceptor for aligned_alloc is missing.


[Bug c++/19241] New: ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net
g++ -v
Using built-in specs.
Configured with: ../configure --prefix=/opt/gcc-head --enable-languages=c,c++
--disable-checking
Thread model: posix
gcc version 4.0.0 20050103 (experimental)


Compile command:
g++ -DHAVE_CONFIG_H -I. -I. -I../../../src -I../../../images -I../../../src
-I../../../src/frontends -I../../../src/frontends/controllers -I../../../boost
-Winvalid-pch --include=./pch.h -O -fno-exceptions -c FormExternal.C -o
FormExternal.o

Result:
/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/debug/safe_base.h:
In member function ‘__gnu_debug::_Safe_iterator::iterator, __gnu_debug_def::map<_Key, _Tp, _Compare,
_Allocator> > __gnu_debug_def::map<_Key, _Tp, _Compare, _Allocator>::end() [with
_Key = std::string, _Tp = lyx::external::Template::Format, _Compare =
std::less, _Allocator = std::allocator >]’:
/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/debug/safe_base.h:88:
internal compiler error: in make_decl_rtl, at varasm.c:867

This error goes away if "--include=./pch.h" is removed.

Also there might be a separate bug here, if I try to run the failing command
with "-save-temps" I just get a bunch or errors:

../../../src/frontends/controllers/Kernel.h:48: error: ‘std’ has not been 
declared
../../../src/frontends/controllers/Kernel.h:48: error: ‘string’ has not been
declared
../../../src/frontends/controllers/Kernel.h:56: error: ‘std’ has not been 
declared
etc...

So it seems that "-save-temps" does not work with precompiled headers.

And because of this I do not have any precompiled sources to offer.

-- 
   Summary: ICE in make_decl_rtl, at varasm.c:867
   Product: gcc
   Version: 4.0.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: larsbj at gullik dot net
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 16:22 
---
Just a comment before I begin work to create a testcase that is abit smaller 
than
the whole lyx distribution. If I turn off concept checks the ICE goes away.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 18:25 
---
Ok, do you want a tar file with the setup to reproduce or do you want me to
attach ~100 attachments to this case with all the files needed to reproduce?

And reading gcc.gnu.org does not make it easier to create a testcase for a bug
that only happens with PCH. Apart from making preprocessed sources for the pch.h
file itself...

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 19:21 
---
I get a bit further with that, but I am not able to reproduce the error with
the resulting .ii file together with the pch.h (and pch.h.gch) file.

Instead I get stuck with myriads or errors similar to these:
../../../src/frontends/controllers/Kernel.h:48: error: âstdâ has not been 
declared
../../../src/frontends/controllers/Kernel.h:48: error: âstringâ has not been
declared
../../../src/frontends/controllers/Kernel.h:56: error: âstdâ has not been 
declared
../../../src/frontends/controllers/Kernel.h:56: error: âstringâ has not been
declared

I'll attch the FormExternal.ii file and the pch.ii file anyway.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] [4.0 Regression] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 19:56 
---
Then I am at a loss. I am only able to reproduce with the full lyx tree, when
using the preprocessed files I get errors about 'std' not being defined. (etc)

How did you compile the preprocessed sources to end up with no errors at all?



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] [4.0 Regression] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 20:19 
---
(In reply to comment #11)

> grep -v ^# FormExternal.ii> FormExternal.cc
> gcc FormExternal.cc -include pch.ii

ok, my mistake was using g++ instead. Using the above I to get a clean compile
(-c). So it is quite obvious that just using preprocessed sources will not 
show the ICE.

Note that not only PCH is turned on when compiling, but libstdc++ debug mode and
concept checking as well.

If I turn concept checking off then it compiles, I have not tried with turning
off debug mode yet.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] [4.0 Regression] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 20:22 
---
(In reply to comment #12)

> ok, my mistake was using g++ instead. 

Not having done the "grep" more likely, and trying to compile the .ii file 
directly.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] [4.0 Regression] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-03 20:28 
---
(In reply to comment #12)
> 
> > grep -v ^# FormExternal.ii> FormExternal.cc
> > gcc FormExternal.cc -include pch.ii
> 
> So it is quite obvious that just using preprocessed sources will not 
> show the ICE.

If I compile like this:

 gcc -c -O -fno-exceptions --include=pch.ii FormExternal.cc

(both -O and -fno-exceptions)

Then I get the usual error:

/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/debug/safe_base.h:
In member function â__gnu_debug::_Safe_iterator::iterator, __gnu_debug_def::map<_Key, _Tp, _Compare,
_Allocator> > __gnu_debug_def::map<_Key, _Tp, _Compare, _Allocator>::end() [with
_Key = std::string, _Tp = lyx::external::Template::Format, _Compare =
std::less, _Allocator = std::allocator >]â:
/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/debug/safe_base.h:88:
internal compiler error: in make_decl_rtl, at varasm.c:867


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] [4.0 Regression] ICE in make_decl_rtl, at varasm.c:867

2005-01-03 Thread larsbj at gullik dot net


-- 
   What|Removed |Added

 Status|WAITING |NEW
 Ever Confirmed||1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug c++/19241] [4.0 Regression] ICE in make_decl_rtl, at varasm.c:867

2005-01-05 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-05 18:14 
---
(In reply to comment #17)
> Lars, can you maybe describe how to reproduce this starting from the lyx  
> tarball? (I.e. which tarball to download, how to configure so that it uses 
> PCH  
> etc.)  

As of today, it seems that I am unable to reproduce using the LyX sources. 
However
if I use the files in the attachments then I get the same error as before.
(as mentioned earlier, the slightest change to the sources made the ICE go 
away) 

There are no tarballs of this LyX dist. Only by CVS unfortunately.
I can create a tar.gz for you if you want it, but I am not sure that it will
help.

g++ (GCC) 4.0.0 20050105 (experimental)

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19241


[Bug middle-end/19583] [4.0 Regression] Incorrect diagnostic: control may reach end of non-void function '...' being inlined

2005-01-29 Thread larsbj at gullik dot net

--- Additional Comments From larsbj at gullik dot net  2005-01-29 19:09 
---
This does not seem to be fixed so reopening.

-- 
   What|Removed |Added

 CC||larsbj at gullik dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19583


[Bug middle-end/19699] [4.0 Regression] warning about not returning from end of a non-void function because of dead code

2005-01-29 Thread larsbj at gullik dot net


-- 
   What|Removed |Added

 CC||larsbj at gullik dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19699


[Bug tree-optimization/104017] unexpeted -Warray-bounds popping a fixed number of std::deque elements

2022-01-18 Thread larsbj at gullik dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104017

Lars Gullik Bjønnes  changed:

   What|Removed |Added

 CC||larsbj at gullik dot net

--- Comment #2 from Lars Gullik Bjønnes  ---
(In reply to Martin Sebor from comment #1)

...
> #include 
> 
> struct Node { Node const * parent = nullptr; };
> 
> void func(Node const * n)
> {
> std::deque p;
> 
> Node const * e = n;
> 
> while (e != nullptr) {
> p.push_front(e);
> e = e->parent;
> }
> 
> if (p.size ())
>   p.pop_front();
> if (p.size ())
>   p.pop_front();
> if (p.size ())
>   p.pop_back();
> }
> 
> 
> This test case also triggers a warning, for the same reason: GCC can't
> determine the relationship between a deque's internal node pointers and the
> result of std::deque::size() (which is a function of the node pointers).

This is also the case amended with a check that the std::deque::size is large
enough (for the same reason). In that case the crash can never happen, still
GCC12 warns/errors.

I agree that the first test case, and the warning from it, is helpful. However
this second one not so much.

[Bug middle-end/107793] New: trivial-auto-var-init=pattern invalid uninitialized variable warning

2022-11-21 Thread larsbj at gullik dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107793

Bug ID: 107793
   Summary: trivial-auto-var-init=pattern invalid uninitialized
variable warning
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: larsbj at gullik dot net
  Target Milestone: ---

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

This is most likely the same as Bug 107411, but with =pattern instead of =zero
and with GCC 12.2.1.

The preprocessed code has been reduced from production code with cvise.

g++ -v -Werror=uninitialized -Wno-return-type -std=gnu++20
-ftrivial-auto-var-init=pattern -c test.cpp.ii
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.2.1-20220819/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20220819 (Red Hat 12.2.1-2) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-Werror=uninitialized' '-Wno-return-type'
'-std=gnu++20' '-ftrivial-auto-var-init=pattern' '-c' '-o' 'test.cpp.o'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/12/cc1plus -fpreprocessed test.cpp.ii
-quiet -dumpbase test.cpp.ii -dumpbase-ext .ii -mtune=generic -march=x86-64
-Werror=uninitialized -Wno-return-type -std=gnu++20 -version
-ftrivial-auto-var-init=pattern -o /tmp/ccWKm8Nk.s
GNU C++20 (GCC) version 12.2.1 20220819 (Red Hat 12.2.1-2)
(x86_64-redhat-linux)
compiled by GNU C version 12.2.1 20220819 (Red Hat 12.2.1-2), GMP
version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++20 (GCC) version 12.2.1 20220819 (Red Hat 12.2.1-2)
(x86_64-redhat-linux)
compiled by GNU C version 12.2.1 20220819 (Red Hat 12.2.1-2), GMP
version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9f5f4abeaa560d9a1c5632825fca686f
test.cpp.ii: In function ‘int make_arg(T) [with int  = 0;
 = int; int  = 0; T = int]’:
test.cpp.ii:16:15: error: ‘D.2668’ is used uninitialized
[-Werror=uninitialized]
   16 |   const auto &arg = arg_mapper().map(val);
  |   ^~~
cc1plus: some warnings being treated as errors

[Bug tree-optimization/104017] unexpected -Warray-bounds popping a fixed number of std::deque elements

2022-05-12 Thread larsbj at gullik dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104017

--- Comment #6 from Lars Gullik Bjønnes  ---
This is from a report I made in private to Martin, for GCC12.
That tidbit seems to have been lost in the bug creation.