[Bug gcov-profile/79392] New: MinGW-w64 backend: programs built with --coverage do not create *.gcda files

2017-02-06 Thread bnagaev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79392

Bug ID: 79392
   Summary: MinGW-w64 backend: programs built with --coverage do
not create *.gcda files
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bnagaev at gmail dot com
  Target Milestone: ---

I believe that for GCC >= 5 with MinGW-w64 backend flag --coverage
doesn't work correctly.

Steps to reproduce:

  * install Debian Stretch (testing)
  * install gcc-mingw-w64 and wine
  * compile the C program [1] with the command
i686-w64-mingw32-gcc --coverage a.c -o a.exe
  * run `wine a.exe`
  * file a.gcda was not created, but it is expected to

[1] the program a.c

  #include 
  int main(int argc, char** argv) {
  if (argc >= 2) {
  printf("argv[1] = %s\n", argv[1]);
  }
  return 0;
  }

See also https://github.com/mxe/mxe/issues/1665
See also
http://lists.nongnu.org/archive/html/mingw-cross-env-list/2017-02/msg9.html
See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854368

[Bug ipa/68175] New: g++ 5.2.1 produces broken executables with devirtualization enabled

2015-11-01 Thread bnagaev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68175

Bug ID: 68175
   Summary: g++ 5.2.1 produces broken executables with
devirtualization enabled
   Product: gcc
   Version: 5.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bnagaev at gmail dot com
  Target Milestone: ---

The following code compiles to a broken executable:

```cpp
#include 

const int BUFFER_SIZE = 4096;
char buffer_[BUFFER_SIZE];

struct BufferedIfstream : public std::ifstream {
BufferedIfstream() {
rdbuf()->pubsetbuf(buffer_, BUFFER_SIZE);
}
};

int main() {
BufferedIfstream fff;
return 0;
}
```

Compilation command:

$ g++-5 bug.cpp -O2 -o bug.exe

Run it:

$ ./bug.exe
Segmentation fault

Options `-Wall -Wextra` produce no warnings.
Options `-fno-strict-aliasing -fwrapv` change nothing.

Without `-O2` (or `-O3`) the bug disappears.
With `-fno-devirtualize` the bug disappears.
With `-O1` the bug disappears but with `-O1 -fdevirtualize` appears again.

Without a class the bug disappears. The following code works correctly:

```cpp
#include 

const int BUFFER_SIZE = 4096;
char buffer_[BUFFER_SIZE];

int main() {
std::ifstream fff;
fff.rdbuf()->pubsetbuf(buffer_, BUFFER_SIZE);
return 0;
}
```

I have reproduced this bug in gcc 5.1.0, 5.2.0 (MXE build, MinGW-w64 [1]) and
in gcc 5.2.1 (Debian Stretch, amd64 Linux, 5.2.1-22). I believe this bug was
introduced in gcc 5, when devirtualization was refactored [2].

The issue seems to be related to the mailing thread about -O3 (MXE): stack
smashing on i686 with -O3 since da82d07dbe [3].

[1] https://github.com/mxe/mxe/issues/964
[2] https://gcc.gnu.org/gcc-5/changes.html
[3]
http://lists.nongnu.org/archive/html/mingw-cross-env-list/2015-10/msg00020.html

[Bug ipa/68175] g++ 5.2.1 produces broken executables with devirtualization enabled

2015-11-04 Thread bnagaev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68175

Boris Nagaev  changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |---

--- Comment #2 from Boris Nagaev  ---
The patch from bug 67056 [1] was applied to MXE [2]. It doesn't work. The
executable produced from my test code (class BufferedIfstream) is crashing. The
patch was applied to Debian Stretch version of gcc (5.2.1-22) and the resulting
gcc compiler makes crashing executables as well.

The code provided in bug 67056 as a test code [3] is compiled to a working
executable by patched MXE, original MXE and Debian Stretch's gcc 5.2.1. Bugs
67056 and 68175 seems not to be the same bug.

Can you confirm that patched gcc (rev. 229148) compiles my test code correctly
(class BufferedIfstream), please?

[1]
https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/ipa-polymorphic-call.c?r1=229148&r2=229147&pathrev=229148
[2]
https://github.com/LuaAndC/mxe/commit/5c47e8ef678ea785b1092272fd3adb51beebff4e
[3]
https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/testsuite/g%2B%2B.dg/ipa/pr67056.C?view=markup&pathrev=229148

[Bug ipa/68175] g++ 5.2.1 produces broken executables with devirtualization enabled

2016-01-10 Thread bnagaev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68175

Boris Nagaev  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Boris Nagaev  ---
It is fixed in Debian Stretch, gcc 5.3.1 20160101 (Debian 5.3.1-5).
It is fixed in MinGW 5.3.0.