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
Consider the following code, on LLVM 3.5, I use "clang -emit-llvm esc.c -c -o esc.bc" and then "llc -march=c esc.bc -o esc-out.c", after I compile esc-out.c, I get an error "else without a previous 'if' ". I also tried some other functions with nested if-else, the same thing happened.
int esc(char _s, int *i)
{
char result;
if (s[_i] != '@')
result = s[_i];
else
if (s[_i + 1] == '\0')
result = '@';
else
{
_i = *i + 1;
if (s[_i] == 'n')
result = 10;
else
if (s[_i] == 't')
result = 9;
else
result = s[_i];
}
return result;
}
The text was updated successfully, but these errors were encountered:
Consider the following code, on LLVM 3.5, I use "clang -emit-llvm esc.c -c -o esc.bc" and then "llc -march=c esc.bc -o esc-out.c", after I compile esc-out.c, I get an error "else without a previous 'if' ". I also tried some other functions with nested if-else, the same thing happened.
int esc(char _s, int *i)
{
char result;
if (s[_i] != '@')
result = s[_i];
else
if (s[_i + 1] == '\0')
result = '@';
else
{
_i = *i + 1;
if (s[_i] == 'n')
result = 10;
else
if (s[_i] == 't')
result = 9;
else
result = s[_i];
}
return result;
}
The text was updated successfully, but these errors were encountered: