[Bug c++/89599] New: C-style function-pointer-to-void* cast is handled inconsistently

2019-03-05 Thread jandemooij+gccbugs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89599

Bug ID: 89599
   Summary: C-style function-pointer-to-void* cast is handled
inconsistently
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jandemooij+gccbugs at gmail dot com
  Target Milestone: ---

When compiling the code below with GCC 8.3.0 or 9, GCC reports an error:

:5:30: error: a reinterpret_cast is not a constant expression

5 | static constexpr void* ptr = (void*)&func1;

  |  ^

However shouldn't it also report an error for the |arr| version?

https://godbolt.org/z/KeEH-2

---

void func1(int x) {}
void func2(char z, bool b) {}

static constexpr void* arr[2] = {(void*)&func1, (void*)func2};
static constexpr void* ptr = (void*)&func1;

int main()
{
return 0;
}

[Bug rtl-optimization/70526] New: GCC 6 miscompiles Firefox JIT compiler

2016-04-04 Thread jandemooij+gccbugs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70526

Bug ID: 70526
   Summary: GCC 6 miscompiles Firefox JIT compiler
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jandemooij+gccbugs at gmail dot com
  Target Milestone: ---

Created attachment 38175
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38175&action=edit
Reduced testcase

See https://bugzilla.mozilla.org/show_bug.cgi?id=1245783

I managed to reduce it to the attached test case.

$ g++ --version
g++-6 (Ubuntu 6-20160319-0ubuntu11) 6.0.0 20160319 (experimental) [trunk
revision 234350]

$ g++-6 -O3 -Wall -o test test.cpp
$ ./test
Fail

It does not print "Fail" with -O0 or with g++ 5.3.1


The problem seems to be on this line:

return TypedOrValueRegister(type, ToAnyRegister(value));

It looks like we read a bogus/uninitialized value from the stack and use that
instead of the result of the ToAnyRegister call.

[Bug tree-optimization/70526] [5 Regression] GCC 6 miscompiles Firefox JIT compiler

2016-04-29 Thread jandemooij+gccbugs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70526

--- Comment #10 from Jan de Mooij  ---
Richards, thank you for fixing that.

Unfortunately Firefox still crashes and my original test case (see comment 0
and the attachment) still fails. Do you have any idea why?

[Bug tree-optimization/70526] [5 Regression] GCC 6 miscompiles Firefox JIT compiler

2016-04-29 Thread jandemooij+gccbugs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70526

--- Comment #12 from Jan de Mooij  ---
(In reply to Richard Biener from comment #11)
> The patch has not yet been backported to GCC 5.

I'm using:

g++-6 (Ubuntu 6.0.1-1ubuntu11) 6.0.0 20160414 (experimental) [trunk revision
234994]

Shouldn't that have the patch? Revision 234994 > 234749.

[Bug rtl-optimization/70526] [5/6 Regression] GCC 6 miscompiles Firefox JIT compiler

2016-04-29 Thread jandemooij+gccbugs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70526

--- Comment #17 from Jan de Mooij  ---
Thank you for looking into this again.

I don't understand comment 16 though:

> _BUT_ here we access D.3125 both as Register (the store)
> and as its declared type TypedOrValueRegister (the load).

So D.3125 is a TypedOrValueRegister right? TypedOrValueRegister is defined as

class TypedOrValueRegister
{
MIRType type_;
AlignedStorage2 typed;
...

So IIUC it's wrong to store to |typed| in the constructor, by doing this:

*typed.addr() = reg;

Why is that? Any suggestions on how to fix this on our end?