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.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
This commit is contained in:
Gaius Mulley 2024-07-28 19:20:43 +01:00
parent 59c6d6a5b5
commit 79e029a418
5 changed files with 36 additions and 3 deletions

View 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));

View file

@ -0,0 +1,5 @@
DEFINITION MODULE testisnormal ;
PROCEDURE test ;
END testisnormal.

View file

@ -1,4 +1,4 @@
MODULE testisnormal ;
IMPLEMENTATION MODULE testisnormal ;
FROM libc IMPORT printf, exit ;
FROM Builtins IMPORT isnormal ;

View file

@ -0,0 +1,5 @@
DEFINITION MODULE testsinl ;
PROCEDURE test ;
END testsinl.

View file

@ -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.