- Where Developers Learn, Share, & Build Careers
I am using the PellesC C compiler Sometimes my code stops working randomly, a special statement Can trigger it. For example, I multiply a variable by sin (c) (c is double) and my code seemed to eliminate execution without execution. Sometimes it gets frozen, sometimes it comes back, but I can always disable it by removing a humiliating statement or compiling optimization, especially "maximum speed" or "maximum speed" if I Adding a printf statement somewhere near that point, if it crashes, the time of freezing will also be about 100% away. I have never found anything to suggest that I am improper to memory I am using the Rike, I'm sure it's a compiler issue is completed. I was thinking that someone could put some light on it. Is it possible that I am actually doing something wrong? Or is it a known issue with the Pelles C compiler?
Editing:
Change
canvas-> pixels [(y * canvas-> pitch) + (x * canvas-> gt; ; BPP) +2] = (unsigned char) (255.0 * dtempA * (1-sin (c))); Canvas-> Pixel [(y * canvas-> pitch) + (x * canvas- gt; bpp) + 1] = (unsigned char) (255.0 * dtempA * (1 + cos (c)); Canvas-> Pixel [(y * canvas-> pitch) + (x * canvas- gt; bpp)] = (unsigned char) (255.0 * dtempA * (1 + sin (c)); (the difference in the end of the last line)
canvas-> pixels [(y * canvas-> pitch) + (x * canvas-> bpp) + 2] = (unsigned char) (255.0 * dtempA * (1-sin (c)); canvas-> pixel [(y * canvas-> pitch) + (x * canvas-> bpp) +1] = (unsigned char) (255.0 * dtempA * (1 + cos (c)); canvas-> pixels [(y * canvas-> pitch) + (x * canvas- gt; bpp )] = (Ah Stored four) (255.0 * dtempA * (1 + 1)); This works.
You are probably using accidentally, somewhere undefined behavior, and changing random instructions in the program, to break the very weak alignment of code on the stack that happens to work in the program.
Comments
Post a Comment