You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example, we'd like to save some work by having the itypes rewritten to the definition:
static int compare (int* a : itype(_Ptr<int>), int* b : itype(_Ptr<int>));
static int compare (int* a, int* b)
{
a = 1;
b = 1;
return 1;
}
Internally, a and b are itypes in both prototypes, because clang merges them. The problem is that 3C avoids rewriting prototypes that don't change, and there's nothing to trigger the change. Make one of them safe, and you'll see that the other itype shows up as well.
It's possible that, because of clang's merge, 3C can't tell that there's a needed rewrite without reading the source during the rewrite phase.
The text was updated successfully, but these errors were encountered:
mattmccutchen-cci
changed the title
Trigger rewriting to propagate itypes
Trigger rewriting to propagate itypes from one declaration to another of the same function
Sep 10, 2021
which of course is a compile error because the itype for atoi isn't available in that translation unit:
bar.c:4:8: error: passing '_Nt_array_ptr<const char>' to parameter of incompatible type 'const char *'
atoi(arg);
^~~
bar.c:1:29: note: passing argument to parameter here
extern int atoi(const char *);
^
Of course, it's bad practice to hard-code declarations of system functions like this, but it did occur in Olden. If we decide not to handle system functions as part of this issue, we can transfer this example to #507.
A similar problem with environ came up in #725. In principle, we can include that case in this issue, although it's going to be harder to fix until 3C has real support for itypes on global variables.
In this example, we'd like to save some work by having the itypes rewritten to the definition:
Internally, a and b are itypes in both prototypes, because clang merges them. The problem is that 3C avoids rewriting prototypes that don't change, and there's nothing to trigger the change. Make one of them safe, and you'll see that the other itype shows up as well.
It's possible that, because of clang's merge, 3C can't tell that there's a needed rewrite without reading the source during the rewrite phase.
The text was updated successfully, but these errors were encountered: