public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/66074] New: gcc_jit_result_get_code returns a void*
@ 2015-05-08 13:25 drako@draconic-bytes.de
  0 siblings, 0 replies; only message in thread
From: drako@draconic-bytes.de @ 2015-05-08 13:25 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-08 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08 13:25 [Bug jit/66074] New: gcc_jit_result_get_code returns a void* drako@draconic-bytes.de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).