forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lcompilers#525 from Smit-create/c_pow
Fix pow in C backend
- Loading branch information
Showing
11 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"basename": "c-expr7-bb2692a", | ||
"cmd": "lpython --no-color --show-c {infile}", | ||
"infile": "tests/expr7.py", | ||
"infile_hash": "4a455e2279eb7dd269d81c1a257dea625b17b100d92e304e5ac34421", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": "c-expr7-bb2692a.stdout", | ||
"stdout_hash": "1300b234a8ba0b61ca9b134d106f05f2d23538aa3b7bcd4c308e6e47", | ||
"stderr": "c-expr7-bb2692a.stderr", | ||
"stderr_hash": "28509dd59a386eebd632340a550d14299cd2a921ef6dc3ac7dbe7fe9", | ||
"returncode": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
style suggestion: Could have used '**' instead of 'pow' | ||
--> tests/expr7.py:3:9 | ||
| | ||
3 | a = pow(2, 2) | ||
| ^^^^^^^^^ '**' could be used instead | ||
|
||
style suggestion: Could have used '**' instead of 'pow' | ||
--> tests/expr7.py:7:11 | ||
| | ||
7 | res = pow(a, b) | ||
| ^^^^^^^^^ '**' could be used instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <assert.h> | ||
#include <complex.h> | ||
#include <inttypes.h> | ||
#include <stdio.h> | ||
#include <math.h> | ||
|
||
#include <lfortran_intrinsics.h> | ||
|
||
void _lpython_main_program() | ||
{ | ||
main0(); | ||
} | ||
|
||
void main0() | ||
{ | ||
int32_t c; | ||
test_pow(); | ||
c = test_pow_1(1, 2); | ||
} | ||
|
||
void test_pow() | ||
{ | ||
int32_t a; | ||
a = __lpython_overloaded_0__pow(2, 2); | ||
} | ||
|
||
int test_pow_1(int32_t a, int32_t b) | ||
{ | ||
int32_t _lpython_return_variable; | ||
int32_t res; | ||
res = __lpython_overloaded_0__pow(a, b); | ||
_lpython_return_variable = res; | ||
return _lpython_return_variable; | ||
} | ||
|
||
int __lpython_overloaded_0__pow(int32_t x, int32_t y) | ||
{ | ||
int32_t _lpython_return_variable; | ||
_lpython_return_variable = pow(x, y); | ||
return _lpython_return_variable; | ||
} | ||
|
||
float _lfortran_caimag(float complex x); | ||
|
||
double _lfortran_zaimag(double complex x); | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
_lpython_main_program(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ filename = "expr7.py" | |
ast = true | ||
asr = true | ||
cpp = true | ||
c = true | ||
|
||
[[test]] | ||
filename = "expr8.py" | ||
|