[Bug libstdc++/93244] std::filesystem::path::generic_string doesn't convert the first slash on Windows

2020-03-06 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93244

--- Comment #8 from Orgad Shaneh  ---
(In reply to CVS Commits from comment #7)
> The master branch has been updated by Jonathan Wakely :
> 
> https://gcc.gnu.org/g:b0815713a32c5cc062bd41fa75dac4d4408215fb
> 
> commit r10-7064-gb0815713a32c5cc062bd41fa75dac4d4408215fb
> Author: Jonathan Wakely 
> Date:   Fri Mar 6 12:03:17 2020 +
> 
> libstdc++: Fix call to __glibcxx_rwlock_init (PR 93244)
> 
> When the target doesn't define PTHREAD_RWLOCK_INITIALIZER we use a
> wrapper around pthread_wrlock_init, but the wrapper only takes one
> argument and we try to call it with two.
> 
> This went unnnoticed on most targets because they do define the
> PTHREAD_RWLOCK_INITIALIZER macro, but it causes a bootstrap failure on
> darwin8.
> 
>   PR libstdc++/93244
>   * include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER]
>   (__shared_mutex_pthread::__shared_mutex_pthread()): Remove incorrect
>   second argument to __glibcxx_rwlock_init.
>   * testsuite/30_threads/shared_timed_mutex/94069.cc: New test.

Wrong bug?

[Bug c++/93244] New: std::filesystem::path::generic_string doesn't convert the first slash on Windows

2020-01-12 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93244

Bug ID: 93244
   Summary: std::filesystem::path::generic_string doesn't convert
the first slash on Windows
   Product: gcc
   Version: 9.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: orgads at gmail dot com
  Target Milestone: ---

#include 

int main()
{
std::cout << std::filesystem::current_path().generic_string() << std::endl;
}

Prints F:\Projects/test/foo/bar/baz

I debugged it a bit, and from
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/fs_path.h#L1136
I saw that the elements are:
* _Root_name (F:) - __add_slash remains false
* _Root_dir (\) - It is appended as it is (that's the bug), and __add_slash
remains false
* From this point, the elements are all _Filename, and forward slashes are
appended.

[Bug libstdc++/93244] std::filesystem::path::generic_string doesn't convert the first slash on Windows

2020-01-13 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93244

--- Comment #3 from Orgad Shaneh  ---
Thank you!

I've noticed in your changed that only on cygwin double leading slashes are
preserved. Why is that? I think it should be the same on all _WIN32 compilers,
like MinGW.

A shared folder is accessed by \\server\share\file.

[Bug c++/53184] New: Unnecessary anonymous namespace warnings

2012-05-01 Thread orgads at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53184

 Bug #: 53184
   Summary: Unnecessary anonymous namespace warnings
Classification: Unclassified
   Product: gcc
   Version: 4.6.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: org...@gmail.com


Created attachment 27279
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27279
sample code

The attached file (stripped preprocessor output) produces the following
warning:

foo.cpp:5:16: warning: 'Bar' has a field 'Bar::foo' whose type uses the
anonymous namespace [enabled by default]


[Bug c++/53184] Unnecessary anonymous namespace warnings

2012-05-01 Thread orgads at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53184

--- Comment #2 from Orgad Shaneh  2012-05-02 06:56:28 
UTC ---
Anonymous types shouldn't produce any warnings. They are very commonly used in
headers needed for both C and C++ projects. The warning is meant for types
inside anonymous namespaces, which is not the case here.

Moreover, removing the volatile keyword resolves the warning. Why is that?


[Bug driver/45749] Response file unwrapped between collect2.exe and ld.exe

2018-07-03 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45749

Orgad Shaneh  changed:

   What|Removed |Added

 CC||orgads at gmail dot com

--- Comment #12 from Orgad Shaneh  ---
I've noticed similar behavior with passing arguments to cc1plus and cc (GCC
8.1.0).

This short script demonstrates the bug:

#!/bin/sh
touch file.h
echo "-g -O0 -w -m32 -fexceptions -x c++-header -o file.gch -c file.h" > resp
seq -f '-IC:/Some/Very/Long/Path/With/Many/Components/%g' 1 1000 >> resp
g++ @resp
# g++.exe: error: CreateProcess: No such file or directory

g++ --verbose output:
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\g++.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32
--build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32
--with-sysroot=/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32
--enable-shared --enable-static --disable-multilib
--enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes
--enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto
--enable-graphite --enable-checking=release --enable-fully-dynamic-string
--enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2
--disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686
--with-tune=generic --with-libiconv --with-system-zlib
--with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static
--with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static
--with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static
--with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static
--with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project'
--with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
-fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include
-I/c/mingw810/prerequisites/i686-zlib-static/include
-I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -fno-ident
-I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include
-I/c/mingw810/prerequisites/i686-zlib-static/include
-I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS='
-I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include
-I/c/mingw810/prerequisites/i686-zlib-static/include
-I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe
-fno-ident -L/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/lib
-L/c/mingw810/prerequisites/i686-zlib-static/lib
-L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib
-Wl,--large-address-aware'
Thread model: posix
gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 
COLLECT_GCC_OPTIONS='-v' '-debug' '-g' '-O0' '-w' '-m32' '-fexceptions' '-o'
'file.gch' '-c' '-I' 'C:/Some/Very/Long/Path/With/Many/Components/1' '-I'
'C:/Some/Very/Long/Path/With/Many/Components/2' ... '-shared-libgcc'
'-mtune=generic' '-march=i686'
 C:/MinGW/bin/../libexec/gcc/i686-w64-mingw32/8.1.0/cc1plus.exe -quiet -v -I
C:/Some/Very/Long/Path/With/Many/Components/1 -I
C:/Some/Very/Long/Path/With/Many/Components/2 ...
C:/MinGW/bin/../lib/gcc/i686-w64-mingw32/8.1.0/ -D_REENTRANT file.h -quiet
-dumpbase file.h -debug -m32 -mtune=generic -march=i686 -auxbase-strip file.gch
-g -O0 -w -version -fexceptions -o F:\Temp\cc9pnz65.s --output-pch= file.gch
g++.exe: error: CreateProcess: No such file or directory

[Bug sanitizer/88215] New: UBSAN: Internal compiler error with attribute(unused)

2018-11-27 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88215

Bug ID: 88215
   Summary: UBSAN: Internal compiler error with attribute(unused)
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: orgads at gmail 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: ---

> cat err.cpp

void foo()
{
unsigned a = 2, __attribute__ ((unused)) b = 1;
unsigned f = a/b;
}

> g++ -fsanitize=undefined -w -O0 -c err.cpp

err.cpp: In function 'void foo()':
err.cpp:4:20: internal compiler error: in ubsan_instrument_division, at
c-family/c-ubsan.c:48
 unsigned f = a/b;

It doesn't happen if the variable is declared separately:

unsigned __attribute__ ((unused)) b = 1;

or

__attribute__ ((unused)) unsigned b = 1;

Looks similar to bug 80348.

[Bug sanitizer/88215] UBSAN: Internal compiler error with attribute(unused)

2018-11-28 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88215

--- Comment #4 from Orgad Shaneh  ---
Thank you!

[Bug c++/57335] internal compiler error: in cxx_eval_bit_field_ref, at cp/semantics.c:6977

2016-05-14 Thread orgads at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57335

--- Comment #14 from Orgad Shaneh  ---
With 6.1, this doesn't only fail for static_assert. Even a simple function call
fails:

struct Bits {
unsigned char a : 7;
unsigned char b : 1;
constexpr Bits() : a(0), b(0) {}
};

struct Foo
{
constexpr Foo(int) { }

constexpr bool b() const { return bits.b; }

private:
Bits bits;
};

void func(bool) {}

void foo() {
constexpr Foo foo(42);
func(foo.b());
}


../test/foo.cpp: In function ‘void foo()’:
../test/foo.cpp:21:14:   in constexpr expansion of ‘foo.Foo::b()’
../test/foo.cpp:21:16: internal compiler error: in cxx_eval_bit_field_ref, at
cp/constexpr.c:2226
 func(foo.b());
 ^
0x6fbb43 cxx_eval_bit_field_ref
../../src/gcc/cp/constexpr.c:2226
0x6fbb43 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3849
0x6fed08 cxx_eval_binary_expression
../../src/gcc/cp/constexpr.c:1725
0x6f9c52 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3806
0x6fed08 cxx_eval_binary_expression
../../src/gcc/cp/constexpr.c:1725
0x6f9c52 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3806
0x6fc651 cxx_eval_store_expression
../../src/gcc/cp/constexpr.c:3123
0x6fa39c cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3633
0x6f9f88 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3645
0x6f92d2 cxx_eval_call_expression
../../src/gcc/cp/constexpr.c:1494
0x6fab6f cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3556
0x6f9f08 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3901
0x6fd1f6 cxx_eval_outermost_constant_expr
../../src/gcc/cp/constexpr.c:4121
0x6feabc maybe_constant_value_1
../../src/gcc/cp/constexpr.c:4316
0x6feabc maybe_constant_value(tree_node*, tree_node*)
../../src/gcc/cp/constexpr.c:4340
0x5d6b11 build_over_call
../../src/gcc/cp/call.c:7561
0x5d879f build_new_function_call(tree_node*, vec**, bool, int)
../../src/gcc/cp/call.c:4152
0x6acaca finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../src/gcc/cp/semantics.c:2461
0x65eaf2 cp_parser_postfix_expression
../../src/gcc/cp/parser.c:6904
0x65cee2 cp_parser_unary_expression
../../src/gcc/cp/parser.c:7988

[Bug tree-optimization/60770] disappearing clobbers

2021-01-27 Thread orgads at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60770

Orgad Shaneh  changed:

   What|Removed |Added

 CC||orgads at gmail dot com

--- Comment #13 from Orgad Shaneh  ---
The case described in comment 1 doesn't issue a warning with GCC 10.

Looks like it's a different case than bug 60517.

[Bug tree-optimization/60770] disappearing clobbers

2021-01-27 Thread orgads at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60770

--- Comment #15 from Orgad Shaneh  ---
test.cpp: In function ‘int f(int)’:
test.cpp:7:11: warning: ‘q’ is used uninitialized in this function
[-Wuninitialized]
7 |   return *p;
  |   ^

Is this the intended description? It doesn't refer to the real problem (storing
a pointer to a variable that is out of scope).