Skip to content

Commit 0564484

Browse files
author
Gaius Mulley
committed
[PATCH] PR modula2/115823 Wrong expansion of isnormal optab
This patch corrects the function declaration of a builtin (using the libname rather than the source name). gcc/m2/ChangeLog: PR modula2/115823 * gm2-gcc/m2builtins.cc (define_builtin): Build the function decl using the libname. gcc/testsuite/ChangeLog: PR modula2/115823 * gm2/builtins/run/pass/testisnormal.mod: Change to an implementation module. * gm2/builtins/run/pass/testisnormal.def: New test. * gm2/builtins/run/pass/testsinl.def: New test. * gm2/builtins/run/pass/testsinl.mod: New test. (cherry picked from commit 79e029a) Signed-off-by: Gaius Mulley <[email protected]>
1 parent 2665f3e commit 0564484

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

gcc/m2/gm2-gcc/m2builtins.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,8 @@ define_builtin (enum built_in_function val, const char *name, tree prototype,
14311431
tree decl;
14321432
builtin_macro_definition bmd;
14331433

1434-
decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, get_identifier (name),
1435-
prototype);
1434+
decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
1435+
get_identifier (libname), prototype);
14361436
DECL_EXTERNAL (decl) = 1;
14371437
TREE_PUBLIC (decl) = 1;
14381438
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DEFINITION MODULE testisnormal ;
2+
3+
PROCEDURE test ;
4+
5+
END testisnormal.

gcc/testsuite/gm2/builtins/run/pass/testisnormal.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MODULE testisnormal ;
1+
IMPLEMENTATION MODULE testisnormal ;
22

33
FROM libc IMPORT printf, exit ;
44
FROM Builtins IMPORT isnormal ;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DEFINITION MODULE testsinl ;
2+
3+
PROCEDURE test ;
4+
5+
END testsinl.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
IMPLEMENTATION MODULE testsinl ;
2+
3+
FROM libc IMPORT printf ;
4+
FROM Builtins IMPORT sinl ;
5+
6+
7+
(*
8+
test -
9+
*)
10+
11+
PROCEDURE test ;
12+
VAR
13+
result: LONGREAL ;
14+
BEGIN
15+
result := sinl (3.14) ;
16+
printf ("sinl (3.14) = %lg\n", result) ;
17+
END test ;
18+
19+
20+
BEGIN
21+
test ;
22+
printf ("all tests pass\n")
23+
END testsinl.

0 commit comments

Comments
 (0)