-
Notifications
You must be signed in to change notification settings - Fork 170
Imports Too Many When Importing From File #1611
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
Comments
I think this is the same issue as #1610, the unused function pass should remove |
This is in the TODO Roadmap of |
It looks like lpython/src/libasr/codegen/asr_to_c.cpp Lines 1297 to 1303 in 5a6e2d2
|
@Shaikh-Ubaid |
These are just a few hard-coded passes that are necessary with the current C tests. We need to add the same approach as the LLVM backend. |
Got it. Thank you! |
This also looks fixed now. C code
#include <complex.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <lfortran_intrinsics.h>
#define ASSERT(cond) \
{ \
if (!(cond)) { \
printf("%s%s", "ASSERT failed: ", __FILE__); \
printf("%s%s", "\nfunction ", __func__); \
printf("%s%d%s", "(), line number ", __LINE__, " at \n"); \
printf("%s%s", #cond, "\n"); \
exit(1); \
} \
}
#define ASSERT_MSG(cond, msg) \
{ \
if (!(cond)) { \
printf("%s%s", "ASSERT failed: ", __FILE__); \
printf("%s%s", "\nfunction ", __func__); \
printf("%s%d%s", "(), line number ", __LINE__, " at \n"); \
printf("%s%s", #cond, "\n"); \
printf("%s", "ERROR MESSAGE:\n"); \
printf("%s%s", msg, "\n"); \
exit(1); \
} \
}
struct dimension_descriptor
{
int32_t lower_bound, length;
};
// Implementations
double __lpython_overloaded_0__pow(int32_t x, int32_t y)
{
double _lpython_return_variable;
_lpython_return_variable = (double)(pow(x, y));
return _lpython_return_variable;
}
float _lfortran_caimag(float complex x);
double _lfortran_zaimag(double complex x);
void test_pow()
{
int32_t a;
a = (int32_t)(__lpython_overloaded_0__pow(2, 2));
}
void _xx_lcompilers_changed_main_xx()
{
test_pow();
}
void _lpython_main_program()
{
_xx_lcompilers_changed_main_xx();
}
int main(int argc, char* argv[])
{
_lpython_main_program();
return 0;
} Is this the expected output @ronnuriel ? |
Closing this as it seems fixed. The functions |
Thanks @Shaikh-Ubaid. If there is still a problem, we can open a new issue. |
Imports too many from import file
Lets create bar.py (bar.py is in the same directory as expr7)
expr7:
Run:
lpython --show-c -I . bar.py
C generated code output:
As you can see it generates more then test_pow (main0, test_pow_1)
while it is wrong.
The text was updated successfully, but these errors were encountered: