[MinGW-Notify] [mingw] #39268: g++ -O1 produces crashing code when accessing dlls via LoadLibrary()/GetProcAddress()/reinterpret_cast

Zurück zum Archiv-Index
MinGW Notification List mingw****@lists*****
Fri May 31 16:51:46 JST 2019


#39268: g++ -O1 produces crashing code when accessing dlls via LoadLibrary()/GetProcAddress()/reinterpret_cast

  Open Date: 2019-05-30 18:26
Last Update: 2019-05-31 08:51

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/39268
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39268

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2019-05-31 08:51 Updated by: keith

Comment:

Reply To keith

    Your J2534_API class constructor initializes its _J2534LIB private member
    variable to NULL; you then invoke its selectLibrary() method ...

BTW, do you really need the selectLibrary() method anyway? I don't know your
requirements specification, but the ability to arbitrarily change the DLL
association of a J2534_API class instance, "on the fly", seems unusual. If you
don't explicitly need such a capability, why not bind the DLL within the
constructor itself, either using a name passed as a constructor argument, or
using a fixed name specified within the constructor code?



---------------------------------------------------------------------
Ticket Status:

      Reporter: comer352l
         Owner: (None)
          Type: Issues
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: (None)
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

I'm investigating the following crash, which occurs when accessing a dll via
LoadLibrary(), getProcAddress(), reinterpret_cast:

Problem signature:

Problem Event Name: BEX
Application Name: test.exe
...
Fault Module Name: StackHash_0a9e
...
Exception Offset: 0028fe9c
Exception Code: c0000005
Exception Data: badc0de1
...
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789



The code only crashes if it is compiled with -O1 (-O2, ...).
Moving around pieces of the code seems to fix the issue.
I was finally able to create some reduced example code with working / non
working variants (attachment follows).



-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/mingw/ticket/39268
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39268



More information about the MinGW-Notify mailing list
Zurück zum Archiv-Index