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

Invalid parameter access #142

Open
pattersonz opened this issue Apr 9, 2021 · 0 comments
Open

Invalid parameter access #142

pattersonz opened this issue Apr 9, 2021 · 0 comments

Comments

@pattersonz
Copy link
Contributor

When parameter variables in functions have implicit configurations and accessed within a function, both values appear.

typedef
#ifdef A
unsigned
#else
signed
#endif
tydef;

void printDigest(tydef x) {
    x++;
}

Produces this output: (desugaring & zjp branches)

#include <stdbool.h>

extern void __static_type_error(char *msg);
extern void __static_renaming(char *renaming, char *original);
extern void __static_condition_renaming(char *expression, char *renaming);

void __static_initializer_default();

extern const bool __static_condition_default_6;
extern const bool __static_condition_default_7;
extern const bool __static_condition_default_8;
void __static_initializer_default() {
__static_renaming("__tydef_0", "tydef");
__static_renaming("__tydef_1", "tydef");
__static_renaming("__printDigest_4", "printDigest");
__static_renaming("__printDigest_5", "printDigest");

__static_condition_renaming("__static_condition_default_6", "(declare-fun |(defined A)| () Bool)(assert |(defined A)|)");
__static_condition_renaming("__static_condition_default_7", "(declare-fun |(defined A)| () Bool)(assert (not |(defined A)|))");
__static_condition_renaming("__static_condition_default_8", "(declare-fun |(defined A)| () Bool)(assert (not |(defined A)|))");

};
typedef unsigned  __tydef_0;
typedef signed  __tydef_1;

// typedef moved to top of scope
// typedef moved to top of scope
void  __printDigest_4 (__tydef_0  __x_2) {

if (__static_condition_default_6) {
{

{
if (__static_condition_default_6) {
 __x_2  ++ ;

}

if (__static_condition_default_7) {
 __x_3  ++ ;

}

}}

}

}
void  __printDigest_5 (__tydef_1  __x_3) {

if (__static_condition_default_8) {
{

{
if (__static_condition_default_6) {
 __x_2  ++ ;

}

if (__static_condition_default_7) {
 __x_3  ++ ;

}

}}

}

}
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

No branches or pull requests

1 participant