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

Variable with generic type assigned to non-generic #734

Open
kyleheadley opened this issue Oct 21, 2021 · 2 comments
Open

Variable with generic type assigned to non-generic #734

kyleheadley opened this issue Oct 21, 2021 · 2 comments
Assignees
Labels
benchmark failure A bug causing a failure in our nightly benchmark tests generic incomplete description

Comments

@kyleheadley
Copy link
Member

This happens in libarchive:

../libarchive/archive_read_support_format_lha.c:289:34: error (init_incompatible): initializing '_Array_ptr<const unsigned char>' with an expression of incompatible type '_Array_ptr<T>' (aka '_Array_ptr<(0, 0) __BoundsInterface>')
        _Array_ptr<const unsigned char> p : count(5 + 1) = h;
                                        ^                  ~
@kyleheadley kyleheadley added benchmark failure A bug causing a failure in our nightly benchmark tests generic incomplete description labels Oct 21, 2021
@kyleheadley kyleheadley self-assigned this Oct 21, 2021
@kyleheadley
Copy link
Member Author

This is allowed in ConstraintVariables.cpp:1865 as long as the generic var is compatible. We could disallow it there, but the problem is that generic functions require the argument (or an interface argument created by 3c) to match the parameter when one is wild and one is not. So we have to distinguish the context or recognize the interface variable. But the interface is a type variable from the generic type, not the full type. So it's used when constraining the type but not when constraining the argument to the param.

So our best solution at the moment is to recognize when the comparison happens at a generic function call site and allow some misuses of that.

@kyleheadley
Copy link
Member Author

Work so far is in branch wild_concrete_equals_generic. It solves all the issues here, but there is one failure (pair) in vsftpd benchmark where a function recognized as generic doesn't have a type parameter. This needs to be debugged before a PR is posted.

ftppolicy.c:70:3: error (failed_expectation): expected a type argument list for a generic function call
  ptrace_sandbox_set_setsockopt_validator(p_sandbox, setsockopt_validator, 0);
  ^
ftppolicy.c:119:5: error (failed_expectation): expected a type argument list for a generic function call
    ptrace_sandbox_set_getsockopt_validator(p_sandbox, getsockopt_validator, 0);
    ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark failure A bug causing a failure in our nightly benchmark tests generic incomplete description
Projects
None yet
Development

No branches or pull requests

1 participant