New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I build Pd, I get torubles that are probably realated with casting float to int. #927
Comments
unable to reproduce in both the current EDIT: in Debian GNU/Linux and no, i wouldn't call this version |
yeah, I forgot to say, I'm on macOS |
well yeah, your screenshot was giving you away :-) are you sure that you are using the latest and greatest Pd (which commit?)? because there is code in place that is supposed to specifically handle the problem you are mentioning (4f9c85e) |
the last very one. I saw this happening in the branch from [knob], then I downloaded the latest source and saw it happening there too... but things work fine in 0.50-2 |
I can't reproduce on Windows.
|
the last very one.
so: which one?
|
Now that the 0.51-0test is out, I do not see this issue anymore, it seems this is related to the other issue that I was having with one of my externals - see #848 So, the problem seems to be that I'm compiling Pd wrong... I will ask on the pd list what I might be doing wrong thanks |
-2147483647 is a typical result of signed integer overflow being undefined behavior. BUT the code of Line 1018 in 15761e5
which is supposed to prevent the potential overflow issue... TBH, I have to no idea what's going on... Do you get the same result for |
x_f1 is float, 0x7fffffff is not representable in float, so the float result of ?: is already out of range, perhaps. I see warnings when compiling, not able to check right now... |
it's not exactly representable as a float. Floats can certainly be larger than 0x7fffffff. Also note that we cast 0x7fffffff to a double, so |
@porres I need you to compare the behavior of large onset values for both |
Ok, I can reproduce the issue when compiling Pd on a Mac with clang. I think Miller cross compiles from Linux with gcc, that might explain the different outcome. Will have a look. And strangely, it only happens with |
The bug is gone when changing
|
I pushed this "fix" to develop, also for consistency with |
@porres please test with latest develop and report back. |
I meant the other one which was promoted to float by the result type of ?:. Fix looks sensible to me. |
I think you're one to something, but I still fail to see where exactly the overflow / undefined behavior occurs... |
|
|
oh, you're right! both clang und GCC decide to round up Things get more interesting for GCC outputs 2147483647 (as I would have expected), while clang outputs whatever value happens to be in |
As a follow-up, here's what happens when converting an "When a conversion is inexact, the value returned is rounded according to the rounding control bits in the MXCSR register or the embedded rounding control bits. |
When I build PD from source on macOS (like the new 0.51-0 test1]), I get this error when I try had the value of 1+e16 for the line number in [text insert]. A related closed issue by thew way: #848
And here's the patch:
test-text.pd.zip
I'm just doing what I've been doing in order to compile Pd for a few years now, and I do:
./autogen.sh
./configure
make
make app
The text was updated successfully, but these errors were encountered: