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

stdlib: fix compilation errors in stdlib #2716

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nurmukhametov
Copy link
Collaborator

All of them caused by unbound casting diagnostic.
Under --debug there are quite a few errors reported: E.g., on atomic swaps, ispc reported:

Error: Unable to find any matching overload for call to function (/*unbound*/ int64 * uniform, varying int64)

This PR allows to use --debug for compilation with enabled stdlib.

All of them caused by unbound casting diagnostic.
Under `--debug` there are quite a few errors reported:
E.g., on atomic swaps, ispc reported:
Error: Unable to find any matching overload for call to function
(/*unbound*/ int64 * uniform, varying int64)
Copy link
Collaborator

@aneshlya aneshlya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it stopped working after v1.18.0 but I don't remember any user-visible changes about unbound variability. I recommend finding the commit after which it stopped working. It's possible that the change wasn't implemented correctly. The same problem can be easily reproduced in the user's code, even without the stdlib.

@nurmukhametov
Copy link
Collaborator Author

Yes, indeed. Consider the following reproducer:

void foo(void *uniform dst, void *uniform src, uniform int32 count) {
    __memcpy32((int8 * uniform) dst, (int8 * uniform) src, count);
}

Run with --debug and --nostdlib:

$ ./bin/ispc t2.ispc -o t.o -O2 --target=avx2-i32x8 --debug --nostdlib
Initial AST
`-Function <t2.ispc:2.5 - 2.67>  "foo"
  `-(body) StmtList <t2.ispc:2.5 - 2.67>
    `-ExprStmt <t2.ispc:2.5 - 2.66>
t2.ispc:2:5: Error: Unable to find any matching overload for call to function "__memcpy32" only considering exact matches.
        Passed types: (/*unbound*/ int8 * uniform, /*unbound*/ int8 * uniform, uniform int32)

    __memcpy32((int8 * uniform) dst, (int8 * uniform) src, count);
    ^^^^^^^^^^

on v1.18.0 fails but good for v1.17.0.

Bisecting between these revisions shows that the guilty PR is #2299.

The underlying cause is not clear for me, because somehow AST dumping functionality interferes with type checking and function overloads resolving, e.g. commenting out this line

debugPrintHelper(DebugPrintPoint::Initial);
made error gone.

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 this pull request may close these issues.

Crash on any input in --debug mode
2 participants