Skip to content

C: Segmentation fault on generated test_math.c #1246

Open
@Smit-create

Description

@Smit-create

I am trying to compile and run the generated C code from integrations/test_math.py. LPython generates the code successfully but running the generated code after compilation gives a Segmentation fault. Debugging more into this found the following issue:
The generated code contains:

double log(double x)
{
    double _lpython_return_variable;
    _lpython_return_variable = _lfortran_dlog(x);
    return _lpython_return_variable;
}

And the _lfortran_dlog in lfortran_intrinsincs.c also uses a function log from math.h

LFORTRAN_API double _lfortran_dlog(double x)
{
    return log(x);
}

I suppose there is an infinite loop of function calls between these functions and hence may lead to a segmentation fault.

Metadata

Metadata

Assignees

Labels

cLabel for C language related changeshelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions