Skip to content

Commit 0f660e0

Browse files
authored
Merge pull request #2193 from Smit-create/i-2187
C: Fix complex types
2 parents 7384e92 + cde0ac4 commit 0f660e0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/libasr/codegen/asr_to_c_cpp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,13 @@ R"(#include <stdio.h>
450450
if (gen_stdcomplex) {
451451
sub = "std::complex<float> ";
452452
} else {
453-
sub = "float complex ";
453+
sub = "float_complex_t ";
454454
}
455455
} else {
456456
if (gen_stdcomplex) {
457457
sub = "std::complex<double> ";
458458
} else {
459-
sub = "double complex ";
459+
sub = "double_complex_t ";
460460
}
461461
}
462462
}

src/libasr/codegen/c_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,13 @@ namespace CUtils {
314314
case ASR::ttypeType::Complex: {
315315
if( kind == 4 ) {
316316
if( is_c ) {
317-
type_src = "float complex";
317+
type_src = "float_complex_t";
318318
} else {
319319
type_src = "std::complex<float>";
320320
}
321321
} else if( kind == 8 ) {
322322
if( is_c ) {
323-
type_src = "double complex";
323+
type_src = "double_complex_t";
324324
} else {
325325
type_src = "std::complex<double>";
326326
}

tests/reference/c-expr7-bb2692a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "c-expr7-bb2692a.stdout",
9-
"stdout_hash": "11026dff0f543f773698075edb3d690f8a475e8639124f1e1dcaef6a",
9+
"stdout_hash": "49af46a64f7f11d442e2216c1bb51d307305cc70980caa7952cc85d1",
1010
"stderr": "c-expr7-bb2692a.stderr",
1111
"stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c",
1212
"returncode": 0

tests/reference/c-expr7-bb2692a.stdout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ double __lpython_overloaded_0__pow(int32_t x, int32_t y)
2323
return _lpython_return_variable;
2424
}
2525

26-
float _lfortran_caimag(float complex x);
26+
float _lfortran_caimag(float_complex_t x);
2727

28-
double _lfortran_zaimag(double complex x);
28+
double _lfortran_zaimag(double_complex_t x);
2929

3030
void test_pow()
3131
{

0 commit comments

Comments
 (0)