https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95665
Bug ID: 95665
Summary: memory access error on passing additional parameters
to Int128
Product: gcc
Version: 8.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: estellnb at elstel dot org
Target Milestone: ---
Created attachment 48725
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48725&action=edit
types.tar.bz2
I have programmed a library for calculating with WIdeInts witgh gcc 8.3.0-6,
Debian Stable. When I started to use the library an opertor (>>) suddenly
returned a wrong result (>> was ignored; result as would be without shifting).
For that program replacing (wi>>2)*3 by wi>>=2 and wi*=3 has helped. However I
then tried to isolate the problem into a test case and it showed that the
additional parameters passed to the procedure calling (wi>>2)*3 caused the
memory access problem. The test program does not return a wrong result but it
crashes with a memory access error. Replacing by wi>>=2, wi*=3 did not help
here. It always crashes as soon as the full parameter list is used. I had tried
to debug the problem and inserting some printf-statements made the values
inside the >> oeprator to be retrieved correctly though the result was still
lost. Another time it returned zero as if that would have been passed as
parameter instead of 32. I currently do not dare to use that WideInt
implementation as it seems to trigger some gcc compiler error.
sample program: test_int128.cpp (only a very few lines)
library: types.h