[GiNaC-list] bug in ex::ex(const std::string&, const ex&)
Richard B. Kreckel
kreckel at in.terlu.de
Thu Apr 4 22:15:40 CEST 2024
Hi Diego,
On 4/4/24 9:29 AM, Diego Conti wrote:
> The function dispatch_reader_fcn is precisely where the
> pointer-to-integer conversion is made.
>
> I can confirm that function alignment is the problem by logging the
> address of sqrt_reader inside
>
> the function get_default_reader (attached patch to default_reader.cpp).
>
> This prints out 140737351734977 before crashing (without the pragma).
> However, the code assumes that the address is even.
>
> With the pragma, the code prints out
>
> 140737351734992
>
> sqrt(3)
>
> and then exits normally.
The comments labelled KLUDGE in parser/parser.cpp hint at something
wrong. I suppose that rather than adding a #pragma, this mechanism
should be fixed. Right away, I don't see what's wrong with this as it
seems to match encode_serial_as_reader_func() in default_reader.cpp:75.
I suppose the reason why it works with Autoconf but not with CMake is
just different optimization: Autoconf turns on -O2 by default but CMake
doesn't, so no optimization. It should of course work with any optimization.
All my best,
-richy.
PS: It's great you care to send patches! Please consider creating them
with context, i.e. using diff -u (as git diff does by default). It makes
them much easier to read and apply.
--
Richard B. Kreckel
<https://in.terlu.de/~kreckel/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://www.ginac.de/pipermail/ginac-list/attachments/20240404/895d04a6/attachment.sig>
More information about the GiNaC-list
mailing list