[Bug c++/114753] New: from_chars aborts with -m32 -ftrapv when passed -9223372036854775808

2024-04-17 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114753

Bug ID: 114753
   Summary: from_chars aborts with -m32 -ftrapv when passed
-9223372036854775808
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gnu.ojxq8 at dralias dot com
  Target Milestone: ---

std::from_chars may abort when used with -m32 -ftrapv on some values.

Without -m32, or without -ftrapv, or using clang, the code works correctly.

To reproduce:

$ cat a.cpp 
#include 
#include 
#include 
int main() {
  int64_t result{};
  std::string_view str{"-9223372036854775808"};
  (void)std::from_chars(str.begin(), str.end(), result);
  return result != -9223372036854775807 - 1;
}


$  g++ -m32 -ftrapv -std=c++17 ./a.cpp && ./a.out 
Aborted (core dumped)

[Bug c++/114740] New: i686-linux-gnu-g++ does not interpret floating point literals as double

2024-04-16 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114740

Bug ID: 114740
   Summary: i686-linux-gnu-g++ does not interpret floating point
literals as double
   Product: gcc
   Version: 13.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gnu.ojxq8 at dralias dot com
  Target Milestone: ---

Starting with i686-linux-gnu-g++-13, including 14, a floating point literal
appears to be no longer interpreted as double.

i686-linux-gnu-g++-12, and earlier, as well as clang, work fine.

Steps to reproduce:

$ echo 'int main() { return double(1e-8) == 1e-8; }' > a.cpp
$ i686-linux-gnu-g++-13 -std=c++03 test.cpp && ./a.out ; echo $?
0
$ i686-linux-gnu-g++-12 -std=c++03 test.cpp && ./a.out ; echo $?
1

[Bug middle-end/90348] [11/12/13/14 Regression] Partition of char arrays is incorrect in some cases

2023-07-19 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348

maic  changed:

   What|Removed |Added

 CC||gnu.ojxq8 at dralias dot com

--- Comment #29 from maic  ---
> GCC 11 branch but no longer with GCC 12+

So is this fixed and can be closed? (Also, the title could be edited then to
remove gcc 12-14)

[Bug c++/109871] New: error: call of overloaded ... ambiguous (std::vector vs designated initializers)

2023-05-16 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109871

Bug ID: 109871
   Summary: error: call of overloaded ... ambiguous (std::vector
vs designated initializers)
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gnu.ojxq8 at dralias dot com
  Target Milestone: ---

When calling an overloaded function or constructor that takes a std::vector, as
well as a struct that allows designated initializers, the code is incorrectly
rejected by all versions of GCC, but accepted by Clang.

Example:


#include 
struct S {};
struct Options {
int opt{};
};
void A(std::vector) {}
void A(Options) {}
int main() { A({.opt = 1}); }


Error:


: In function 'int main()':
:8:15: error: call of overloaded 'A()'
is ambiguous
8 | int main() { A({.opt = 1}); }
  |  ~^~~~
:6:6: note: candidate: 'void A(std::vector)'
6 | void A(std::vector) {}
  |  ^
:7:6: note: candidate: 'void A(Options)'
7 | void A(Options) {}
  |  ^
Compiler returned: 1


There is PR 59389 and PR 86997, but they seem unrelated because they are not
about designated initializers.

[Bug sanitizer/109786] New: basic_string.h: runtime error: execution reached an unreachable program point

2023-05-09 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109786

Bug ID: 109786
   Summary: basic_string.h: runtime error: execution reached an
unreachable program point
   Product: gcc
   Version: 13.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gnu.ojxq8 at dralias dot com
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, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Steps to reproduce:

$ cat /tmp/a.cpp 
#include 
#include 

int main() {
  std::istringstream s5{"cc\"\""};
  std::string{std::istreambuf_iterator{s5},
  std::istreambuf_iterator{}};
}



$ g++ -O1 -std=c++11 -g -fsanitize=undefined /tmp/a.cpp -o /tmp/a.exe



$ UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1:report_error_type=1"
/tmp/a.exe
/usr/include/c++/13/bits/basic_string.h:278:29: runtime error: execution
reached an unreachable program point
#0 0x55dd4d73e0a4 in std::__cxx11::basic_string, std::allocator >::_M_is_local() const
/usr/include/c++/13/bits/basic_string.h:278
#1 0x55dd4d73e0a4 in std::__cxx11::basic_string, std::allocator >::_M_dispose()
/usr/include/c++/13/bits/basic_string.h:293
#2 0x55dd4d73e0a4 in void std::__cxx11::basic_string, std::allocator
>::_M_construct >
>(std::istreambuf_iterator >,
std::istreambuf_iterator >,
std::input_iterator_tag) /usr/include/c++/13/bits/basic_string.tcc:200
#3 0x55dd4d73c28b in std::__cxx11::basic_string, std::allocator
>::basic_string >,
void>(std::istreambuf_iterator >,
std::istreambuf_iterator >, std::allocator
const&) /usr/include/c++/13/bits/basic_string.h:764
#4 0x55dd4d73c28b in main /tmp/a.cpp:6
#5 0x7f643a914189  (/lib/x86_64-linux-gnu/libc.so.6+0x27189) (BuildId:
0401bd8da6edab3e45399d62571357ab12545133)
#6 0x7f643a914244 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x27244) (BuildId:
0401bd8da6edab3e45399d62571357ab12545133)
#7 0x55dd4d73c130 in _start (/tmp/a.exe+0x5130) (BuildId:
fc448195ace49adf593e007a4bfd6e5ca471ad7d)

[Bug c++/107532] [13 Regression] -Werror=dangling-reference false positives in libcamera-0.0.1

2023-04-12 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532

--- Comment #31 from maic  ---
Would be nice if this was re-opened, or should a new bug be filed?

[Bug c/89180] [meta-bug] bogus/missing -Wunused warnings

2023-04-11 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89180
Bug 89180 depends on bug 98450, which changed state.

Bug 98450 Summary: Inconsistent Wunused-variable warning for std::array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98450

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug c++/98450] Inconsistent Wunused-variable warning for std::array

2023-04-11 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98450

maic  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from maic  ---
Fixed in 

# gcc --version 
gcc (GCC) 13.0.1 20230404 (Red Hat 13.0.1-0)

[Bug c++/107532] [13 Regression] -Werror=dangling-reference false positives in libcamera-0.0.1

2023-04-11 Thread gnu.ojxq8 at dralias dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532

--- Comment #30 from maic  ---
This bug still exists for our project. To reproduce:


# g++ --version 
g++ (GCC) 13.0.1 20230404 (Red Hat 13.0.1-0)


# cat /tmp/2.cpp 
const int (const int , const bool ) { return i; }
int main() {
  int a;
  const auto {Select(a, true)};
}


# g++ -Wdangling-reference /tmp/2.cpp 
/tmp/2.cpp: In function ‘int main()’:
/tmp/2.cpp:4:15: warning: possibly dangling reference to a temporary
[-Wdangling-reference]
4 |   const auto {Select(a, true)};
  |   ^
/tmp/2.cpp:4:23: note: the temporary was destroyed at the end of the full
expression ‘Select(a, true)’
4 |   const auto {Select(a, true)};
  | ~~^