Skip to content

Add support for multiple integers value for attribute and NonNull #28

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

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

GuillaumeGomez
Copy link
Member

For now this implementation doesn't work. Need to figure out what I did wrong.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Sep 19, 2023

gcc:

r:[irange] _Bool [0, 0] NONZERO 0x0
true_range:[irange] _Bool [1, 1]
false_range:[irange] _Bool [0, 0] NONZERO 0x0

libgccjit:

r:[irange] bool VARYING
true_range:[irange] bool [1, 1]
false_range:[irange] bool [0, 0] NONZERO 0x0

With this C code:

__attribute__((nonnull(1)))
int t(int *a) {
  if (!a) {
    return -1;
  }
  else {
      return *a;
  }
}

We need to understand why range isn't updated with gccjit:

gcc:

r:[irange] _Bool [0, 0] NONZERO 0x0

vs libgccjit:

r:[irange] bool VARYING

@GuillaumeGomez GuillaumeGomez force-pushed the non-null branch 11 times, most recently from 641c166 to 0c99215 Compare September 22, 2023 15:14
@GuillaumeGomez
Copy link
Member Author

All fixed. Now remains to move the check earlier (in add_attribute methods directly) and to handle no_add_attrs.

continue;

tree tree_list = NULL_TREE;
tree *pp = &tree_list;
Copy link

Choose a reason for hiding this comment

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

I'd like a more descriptive name than pp.

@@ -113,7 +115,8 @@ class context : public log_user
int is_variadic,
enum built_in_function builtin_id,
const std::vector<gcc_jit_fn_attribute> &attributes,
const std::vector<std::pair<gcc_jit_fn_attribute, std::string>> &string_attributes,
const std::vector<std::pair<gcc_jit_fn_attribute, std::string>> &string_attributes,
Copy link

Choose a reason for hiding this comment

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

Seems like the tabs got lost here.

@GuillaumeGomez
Copy link
Member Author

Questions to ask David when we'll send the attributes patch upstream:

  • Should we check attributes in the API?
  • Is it valid to use warning/error in handle_attribute_* functions?
    • If yes, should we add warning/error in already existing handle_attribute_* functions?

@antoyo antoyo merged commit 42f9055 into rust-lang:master Oct 10, 2023
@GuillaumeGomez GuillaumeGomez deleted the non-null branch October 10, 2023 21:49
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.

3 participants