This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug jit/66074] New: gcc_jit_result_get_code returns a void*


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66074

            Bug ID: 66074
           Summary: gcc_jit_result_get_code returns a void*
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: drako@draconic-bytes.de
  Target Milestone: ---

The problem with this is, that the ISO C and C++ standards do not guarantee,
that object pointers (like void*) and function pointers (like void(*)(void))
can be converted to each other.

Basically a void* might be too small to hold the address of a function on a
specific operating system or processor architecture.

The dlsym function from the POSIX standard has the same defect, which is also
documented:
http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html
See the section "RATIONALE".

This is also a nice explanatory article about that issue:
http://www.trilithium.com/johan/2004/12/problem-with-dlsym/

In the end there would be a need for two functions: one returning a function
pointer and one returning an object pointer.
But that is not a problem for gccjit as gcc_jit_result_get_global already exist
for querying object pointers.
So gcc_jit_result_get_code could easily be changed to return a function
pointer.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]