]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR modula2/115823 Wrong expansion of isnormal optab
authorGaius Mulley <gaiusmod2@gmail.com>
Sun, 28 Jul 2024 18:20:43 +0000 (19:20 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sun, 28 Jul 2024 18:20:43 +0000 (19:20 +0100)
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.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-gcc/m2builtins.cc
gcc/testsuite/gm2/builtins/run/pass/testisnormal.def [new file with mode: 0644]
gcc/testsuite/gm2/builtins/run/pass/testisnormal.mod
gcc/testsuite/gm2/builtins/run/pass/testsinl.def [new file with mode: 0644]
gcc/testsuite/gm2/builtins/run/pass/testsinl.mod [new file with mode: 0644]

index e3e55a699917fd8262b187b382d9288bae995a91..44f48fc01ba8baa031a54119e487efe8e81cc9a6 100644 (file)
@@ -1431,8 +1431,8 @@ define_builtin (enum built_in_function val, const char *name, tree prototype,
   tree decl;
   builtin_macro_definition bmd;
 
-  decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, get_identifier (name),
-                     prototype);
+  decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+                    get_identifier (libname), prototype);
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
diff --git a/gcc/testsuite/gm2/builtins/run/pass/testisnormal.def b/gcc/testsuite/gm2/builtins/run/pass/testisnormal.def
new file mode 100644 (file)
index 0000000..df01cc3
--- /dev/null
@@ -0,0 +1,5 @@
+DEFINITION MODULE testisnormal ;
+
+PROCEDURE test ;
+
+END testisnormal.
index 6b65a7b9b12215e2b5cc89016167fdd322be96f8..1349d80e8e8eb04df6930e7fde8bb0079e6614e5 100644 (file)
@@ -1,4 +1,4 @@
-MODULE testisnormal ;
+IMPLEMENTATION MODULE testisnormal ;
 
 FROM libc IMPORT printf, exit ;
 FROM Builtins IMPORT isnormal ;
diff --git a/gcc/testsuite/gm2/builtins/run/pass/testsinl.def b/gcc/testsuite/gm2/builtins/run/pass/testsinl.def
new file mode 100644 (file)
index 0000000..7afd3cc
--- /dev/null
@@ -0,0 +1,5 @@
+DEFINITION MODULE testsinl ;
+
+PROCEDURE test ;
+
+END testsinl.
diff --git a/gcc/testsuite/gm2/builtins/run/pass/testsinl.mod b/gcc/testsuite/gm2/builtins/run/pass/testsinl.mod
new file mode 100644 (file)
index 0000000..7f669f8
--- /dev/null
@@ -0,0 +1,23 @@
+IMPLEMENTATION MODULE testsinl ;
+
+FROM libc IMPORT printf ;
+FROM Builtins IMPORT sinl ;
+
+
+(*
+   test -
+*)
+
+PROCEDURE test ;
+VAR
+   result: LONGREAL ;
+BEGIN
+   result := sinl (3.14) ;
+   printf ("sinl (3.14) = %lg\n", result) ;
+END test ;
+
+
+BEGIN
+   test ;
+   printf ("all tests pass\n")
+END testsinl.