* Re: Is it safe to use unaligned pointer with libgccjit? [not found] <dDwVLLtiT3r_Pr2bf4jczXoA5OgpC1X0qnYFzCbUXcxL4wKGXJHt49iOK6XBMhm3v_LJLVPhWbenBOkWAsrbJj4heMDviG7qoMJwJgIYKNY=@zhuyi.fan> @ 2023-09-30 7:44 ` Basile Starynkevitch 0 siblings, 0 replies; only message in thread From: Basile Starynkevitch @ 2023-09-30 7:44 UTC (permalink / raw) To: Schrodinger ZHU Yifan; +Cc: jit [-- Attachment #1: Type: text/plain, Size: 1602 bytes --] On 9/30/23 02:29, Schrodinger ZHU Yifan via Jit wrote: > Hi, > I wonder if it is safe to use trailing bits as tags and passing them as some non-opaque type pointers. There isn't any direct dereference on such unaligned pointers, of course. libgccjit <https://gcc.gnu.org/onlinedocs/jit/index.html> is in practice yet another front-end to the GCC compiler suite. So it should in practice be safe to do so. My suggestion is (on Linux systems at least) to write a small C program (or even a small C file containing a single C routine) doing what you want, to write a small libgccjit example doing the same. Then compile your small C program to produce its assembler code (using gcc -O -S -fverbose-asm). Do the same with your libgccjit toy example. Use gcc_jit_context_dump_reproducer_to_filewithgcc_jit_context_add_command_line_optionor the GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE If you found substantial differences, report a bug in libgccjit. By the way my pet open source project is the RefPerSys <http://refpersys.org/> open source inference engine project on https://github.com/RefPerSys/RefPerSys (and we do generate at runtime some code and want to generate more and more of it: currently generating C++ code and using GNU lightning <https://www.gnu.org/software/lightning/> to generate machine code). RefPerSys is work in progress, and we welcome contributors. Regards from near Paris in France -- Basile Starynkevitch<basile@starynkevitch.net> (only mine opinions / les opinions sont miennes uniquement) 92340 Bourg-la-Reine, France web page: starynkevitch.net/Basile/ ^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-30 7:44 UTC | newest] Thread overview: (only message) (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <dDwVLLtiT3r_Pr2bf4jczXoA5OgpC1X0qnYFzCbUXcxL4wKGXJHt49iOK6XBMhm3v_LJLVPhWbenBOkWAsrbJj4heMDviG7qoMJwJgIYKNY=@zhuyi.fan> 2023-09-30 7:44 ` Is it safe to use unaligned pointer with libgccjit? Basile Starynkevitch
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).