public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit
@ 2024-02-27 15:24 gaius at gcc dot gnu.org
2024-02-27 15:39 ` [Bug modula2/114133] " gaius at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-02-27 15:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
Bug ID: 114133
Summary: problem passing a string pointer to a C function on
solaris 32 bit and 64 bit
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: modula2
Assignee: gaius at gcc dot gnu.org
Reporter: gaius at gcc dot gnu.org
Target Milestone: ---
This is a follow on from:
Bug 114026 - incorrect location during for loop type check
which occurred when I added a new testcase and was reported as failing:
Two of the new tests FAIL on 32 and 64-bit Solaris/SPARC:
+FAIL: gm2/extensions/run/pass/callingc10.mod execution, -O
+FAIL: gm2/extensions/run/pass/callingc10.mod execution, -O -g
+FAIL: gm2/extensions/run/pass/callingc10.mod execution, -O3
-fomit-frame-point
er
+FAIL: gm2/extensions/run/pass/callingc10.mod execution, -O3
-fomit-frame-point
er -finline-functions
+FAIL: gm2/extensions/run/pass/callingc10.mod execution, -Os
+FAIL: gm2/extensions/run/pass/callingc10.mod execution, -g
+FAIL: gm2/extensions/run/pass/callingc11.mod execution, -O
+FAIL: gm2/extensions/run/pass/callingc11.mod execution, -O -g
+FAIL: gm2/extensions/run/pass/callingc11.mod execution, -O3
-fomit-frame-pointer
+FAIL: gm2/extensions/run/pass/callingc11.mod execution, -O3
-fomit-frame-pointer -finline-functions
+FAIL: gm2/extensions/run/pass/callingc11.mod execution, -Os
+FAIL: gm2/extensions/run/pass/callingc11.mod execution, -g
The failure mode is the same for both:
parameter is hello and length 0
executed
/var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/gm2/callingc10.x0 with
result fail
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
@ 2024-02-27 15:39 ` gaius at gcc dot gnu.org
2024-02-27 15:59 ` gaius at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-02-27 15:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed| |2024-02-27
--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
The gimple IR looks correct, given the input code:
MODULE callingc10 ;
FROM cvararg IMPORT funcptr ;
FROM SYSTEM IMPORT ADR ;
BEGIN
IF funcptr (1, "hello", 5) = 1
THEN
END ;
IF funcptr (1, "hello" + " ", 6) = 1
THEN
END ;
IF funcptr (1, "hello" + " " + "world", 11) = 1
THEN
END
END callingc10.
$ gm2 -g callingc10.mod -c -fdump-ipa-all
$ cat callingc10.mod.095i.comdats
...
PROC _M2_callingc10_init (INTEGER argc, PROC * argv, PROC * envp)
{
INTEGER D.670;
INTEGER D.669;
INTEGER D.668;
PROC * _T34.0_1;
INTEGER _2;
INTEGER _T35.1_3;
PROC * _T36.2_4;
INTEGER _5;
INTEGER _T37.3_6;
PROC * _T38.4_7;
INTEGER _8;
INTEGER _12;
INTEGER _16;
INTEGER _20;
<bb 2> :
_T34 = "hello";
_T34.0_1 = _T34;
_12 = funcptr (1, _T34.0_1, 5);
_2 = _12;
_T35 = _2;
_T35.1_3 = _T35;
...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
2024-02-27 15:39 ` [Bug modula2/114133] " gaius at gcc dot gnu.org
@ 2024-02-27 15:59 ` gaius at gcc dot gnu.org
2024-02-27 16:11 ` gaius at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-02-27 15:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 57552
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57552&action=edit
Query proposed fix
Does this patch fix the problem?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
2024-02-27 15:39 ` [Bug modula2/114133] " gaius at gcc dot gnu.org
2024-02-27 15:59 ` gaius at gcc dot gnu.org
@ 2024-02-27 16:11 ` gaius at gcc dot gnu.org
2024-05-07 18:24 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-02-27 16:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
--- Comment #3 from Gaius Mulley <gaius at gcc dot gnu.org> ---
At a guess the problem was the ZTyped constant (1 and 5). Now the gimple IR
shows these constants as integers:
$ cat callingc10.mod.095i.comdats
PROC _M2_callingc10_init (INTEGER argc, PROC * argv, PROC * envp)
{
INTEGER D.676;
INTEGER D.675;
INTEGER D.674;
INTEGER _T35.0_1;
PROC * _T36.1_2;
INTEGER _T34.2_3;
INTEGER _4;
INTEGER _T37.3_5;
INTEGER _T39.4_6;
PROC * _T40.5_7;
INTEGER _T38.6_8;
INTEGER _9;
INTEGER _T41.7_10;
INTEGER _T43.8_11;
PROC * _T44.9_12;
INTEGER _T42.10_13;
INTEGER _14;
INTEGER _20;
INTEGER _26;
INTEGER _32;
<bb 2> :
_T34 = 1;
_T35 = 5;
_T36 = "hello";
_T35.0_1 = _T35;
_T36.1_2 = _T36;
_T34.2_3 = _T34;
_20 = funcptr (_T34.2_3, _T36.1_2, _T35.0_1);
_4 = _20;
_T37 = _4;
_T37.3_5 = _T37;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
` (2 preceding siblings ...)
2024-02-27 16:11 ` gaius at gcc dot gnu.org
@ 2024-05-07 18:24 ` cvs-commit at gcc dot gnu.org
2024-05-07 18:57 ` cvs-commit at gcc dot gnu.org
2024-05-07 18:59 ` gaius at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 18:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:76e591200f54226290ddb49b8ac6231a694bf882
commit r15-300-g76e591200f54226290ddb49b8ac6231a694bf882
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Tue May 7 19:24:08 2024 +0100
PR modula2/114133 bugfix constants must be cast prior to vararg call
This bug fix corrects the test codes below by converting the constant
literals to the type required by C. In the testcases below the values, 1
etc were converted into the INTEGER type before being passed to a C
vararg function. By default in modula2 constant literal ordinals are
represented as the ZTYPE (the largest GCC integer type node).
gcc/testsuite/ChangeLog:
PR modula2/114133
* gm2/extensions/run/pass/callingc10.mod: Convert constant
literal numbers into INTEGER.
* gm2/extensions/run/pass/callingc11.mod: Ditto.
* gm2/extensions/run/pass/vararg2.mod: Ditto.
* gm2/iso/run/pass/packed.mod: Emit a printf as a runtime
diagnostic.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
` (3 preceding siblings ...)
2024-05-07 18:24 ` cvs-commit at gcc dot gnu.org
@ 2024-05-07 18:57 ` cvs-commit at gcc dot gnu.org
2024-05-07 18:59 ` gaius at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 18:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Gaius Mulley
<gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:07dab3f6b56c711dcd737d856cf01a597a2e1626
commit r14-10179-g07dab3f6b56c711dcd737d856cf01a597a2e1626
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Tue May 7 19:51:08 2024 +0100
[PR modula2/113768][PR modula2/114133] bugfix constants must be cast prior
to vararg call
This bug fix corrects the test codes below by converting the constant
literals to the type required by C. In the testcases below the values, 1
etc were converted into the INTEGER type before being passed to a C
vararg function. By default in modula2 constant literal ordinals are
represented as the ZTYPE (the largest GCC integer type node).
gcc/testsuite/ChangeLog:
PR modula2/113768
PR modula2/114133
* gm2/extensions/run/pass/callingc10.mod: Convert constant literal
numbers into INTEGER.
* gm2/extensions/run/pass/callingc11.mod: Ditto.
* gm2/extensions/run/pass/vararg2.mod: Ditto.
* gm2/iso/run/pass/packed.mod: Emit a printf as a runtime
diagnostic.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
` (4 preceding siblings ...)
2024-05-07 18:57 ` cvs-commit at gcc dot gnu.org
@ 2024-05-07 18:59 ` gaius at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-05-07 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now that the patch has been applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-05-07 18:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 15:24 [Bug modula2/114133] New: problem passing a string pointer to a C function on solaris 32 bit and 64 bit gaius at gcc dot gnu.org
2024-02-27 15:39 ` [Bug modula2/114133] " gaius at gcc dot gnu.org
2024-02-27 15:59 ` gaius at gcc dot gnu.org
2024-02-27 16:11 ` gaius at gcc dot gnu.org
2024-05-07 18:24 ` cvs-commit at gcc dot gnu.org
2024-05-07 18:57 ` cvs-commit at gcc dot gnu.org
2024-05-07 18:59 ` gaius at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).