Skip to content
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

internal narrowing conversion error in ppu/include/vectormath/cpp/quat_aos.h #70

Closed
ParzivalWolfram opened this issue May 7, 2020 · 14 comments · Fixed by #75
Closed

Comments

@ParzivalWolfram
Copy link

Potential issue with PSL1GHT:

Reproduction code: make -f Makefile.ps3 from https://github.com/emukidid/wii64-ps3 current master (commit 85b23eeaf0c3ef224cdde6074bcda99339b6274f for future reference)

Error:

/usr/local/ps3dev/ppu/include/vectormath/cpp/quat_aos.h:502:100: error: narrowing conversion of '2147483648' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
     return Quat( vec_xor( quat.get128(), ((vec_float4)(vec_int4){0x80000000,0x80000000,0x80000000,0}) ) );```
@miigotu
Copy link
Member

miigotu commented May 7, 2020

You can add -Wno-narrowing to the cpp flags in that makefile.

It should work fine, but we should also explicitly static_cast that line or update the include.

@zeldin
Copy link
Member

zeldin commented May 7, 2020

Is the value supposed to be 2147483648? In that case I guess the code should simply say
(vec_uint4){0x80000000U,0x80000000U,0x80000000U,0}
instead?

@ParzivalWolfram
Copy link
Author

ParzivalWolfram commented May 7, 2020 via email

@zeldin
Copy link
Member

zeldin commented May 7, 2020

Since the value is an operand to XOR, using 0x7FFFFFFF would give a very different result I think. The intention seems to be to invert the sign bit, not every bit except the sign bit. 😸

@zeldin
Copy link
Member

zeldin commented May 7, 2020

Come to think of it, maybe the whole thing can be rewritten to
return Quat( vec_xor( quat.get128(), ((vec_float4){-0.0, -0.0, -0.0, 0.0})));
without involving any integers at all?

@ParzivalWolfram
Copy link
Author

ParzivalWolfram commented May 7, 2020 via email

@miigotu
Copy link
Member

miigotu commented May 12, 2020

Pretty sure just changing the cast to vec_uint4 is enough:

return Quat( vec_xor( quat.get128(), ((vec_float4)(vec_uint4){0x80000000,0x80000000,0x80000000,0}) ) );

I don't have the toolchain/libraries set up to test that out though

@bucanero
Copy link

I've got a similar problem trying to build the rsxtest sample from PSL1GHT ( https://github.com/ps3dev/PSL1GHT/tree/master/samples/graphics/rsxtest )

by running make, I get the same error about the narrowing conversion.

Following @miigotu comment, I tried casting to vec_uint4 (modified line 502 in /usr/local/ps3dev/ppu/include/vectormath/cpp/quat_aos.h )

Tried to compile again, and to my surprise, I've got a very weird error (at least for my limited knowledge):

% make
main.cpp
/Users/dparrino/github/psl1ght-libs/samples/psl1ght/graphics/rsxtest/source/main.cpp: In function 'int main(int, const char**)':
/Users/dparrino/github/psl1ght-libs/samples/psl1ght/graphics/rsxtest/source/main.cpp:556:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  s32 ret,i;
      ^~~
/Users/dparrino/github/psl1ght-libs/samples/psl1ght/graphics/rsxtest/source/main.cpp: In function 'void program_exit_callback()':
/Users/dparrino/github/psl1ght-libs/samples/psl1ght/graphics/rsxtest/source/main.cpp:410:1: internal compiler error: in rs6000_savres_routine_name, at config/rs6000/rs6000.c:28661
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

did I truly broke gcc, or I did something wrong on my side?

thanks for the help

@miigotu
Copy link
Member

miigotu commented Jun 16, 2020

@bucanero the first error is easily worked around, by passing -Wno-unused-but-set-variable as a cflag.

@bucanero
Copy link

bucanero commented Jun 16, 2020

@bucanero the first error is easily worked around, by passing -Wno-unused-but-set-variable as a cflag.

oh yes, the unused variable is not a big deal, what I have no clue about is the internal compiler error 😕

/Users/dparrino/github/psl1ght-libs/samples/psl1ght/graphics/rsxtest/source/main.cpp:410:1: internal compiler error: in rs6000_savres_routine_name, at config/rs6000/rs6000.c:28661
 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

it's the first time I see gcc telling me to submit a bug report . I just wanted to check if it was a problem on my side , or someone else also got this issue when trying to build rsxtest

@miigotu
Copy link
Member

miigotu commented Jun 16, 2020

Ideally someone should just update vectormath in PSL1GHT
In the updated library, there is a commit that fixes this same error:
erwincoumans/sce_vectormath@5cd9fd0

Maybe we should replace vectormath from here: https://github.com/erwincoumans/sce_vectormath/tree/master/include/vectormath

miigotu added a commit that referenced this issue Jun 16, 2020
@miigotu
Copy link
Member

miigotu commented Jun 16, 2020

@bucanero can you try checking out the bug/issue-70 branch and compile that?

@bucanero
Copy link

@miigotu sure, I'll check out and try to compile. 👍

I'll report back with my results.

@bucanero
Copy link

bucanero commented Jun 16, 2020

Sorry for the delay, using the fix from bug/issue-70 removed the narrowing conversion error, but the example still fails to compile.

I'll try #77 next.

Edit: at least from my tests, after applying patch from bug/issue-70 and removing the -Os compiler flag from the Makefile, everything worked. I could build the rsxtest example, and execute it correctly on my PS3.

miigotu added a commit that referenced this issue Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants