public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments
@ 2021-04-28 12:35 christophm30 at gmail dot com
2021-04-28 21:23 ` [Bug target/100316] " wilson at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: christophm30 at gmail dot com @ 2021-04-28 12:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
Bug ID: 100316
Summary: Regression: __clear_cache() does not support
NULL-pointer arguments
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: christophm30 at gmail dot com
Target Milestone: ---
Commit c05ece9 changed __clear_cache () such, that it no longer accepts numeric
values as arguments.
In riscv-pk the following code is used to clear the instruction cache:
__clear_cache(0, 0);
However, this no longer compiles:
../pk/pk.c: In function 'run_loaded_program.constprop':
../pk/pk.c:177:3: error: both arguments to '__builtin___clear_cache'
must be pointers
177 | __clear_cache(0, 0);
| ^~~~~~~~~~~~~~~~~~~
Also using "NULL" or "(void*)0" does not help.
The corresponding bug ticket for PK can be found here:
https://github.com/riscv/riscv-pk/issues/239
Is there a chance to loosen the restrictions for the arguments?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/100316] Regression: __clear_cache() does not support NULL-pointer arguments
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
@ 2021-04-28 21:23 ` wilson at gcc dot gnu.org
2021-10-07 10:31 ` [Bug middle-end/100316] [11/12 Regression] " pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-04-28 21:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
Jim Wilson <wilson at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aoliva at gcc dot gnu.org,
| |wilson at gcc dot gnu.org
--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> ---
Constant addresses are VOIDmode, and it only accepts Pmode and ptr_mode. It
should accept VOIDmode too. For instance cse_lookup_mem does this
addr_mode = GET_MODE (XEXP (x, 0));
if (addr_mode == VOIDmode)
addr_mode = Pmode;
This stems from changes that Alexandre Oliva made. Adding him to the cc list.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
2021-04-28 21:23 ` [Bug target/100316] " wilson at gcc dot gnu.org
@ 2021-10-07 10:31 ` pinskia at gcc dot gnu.org
2021-10-11 6:15 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-07 10:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-10-07
Summary|Regression: __clear_cache() |[11/12 Regression]
|does not support |__clear_cache() does not
|NULL-pointer arguments |support NULL-pointer
| |arguments
Target Milestone|--- |11.3
Status|UNCONFIRMED |NEW
Component|target |middle-end
Keywords| |rejects-valid
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
2021-04-28 21:23 ` [Bug target/100316] " wilson at gcc dot gnu.org
2021-10-07 10:31 ` [Bug middle-end/100316] [11/12 Regression] " pinskia at gcc dot gnu.org
@ 2021-10-11 6:15 ` cvs-commit at gcc dot gnu.org
2021-10-11 6:28 ` kito at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-11 6:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kito Cheng <kito@gcc.gnu.org>:
https://gcc.gnu.org/g:4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d
commit r12-4281-g4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Thu Oct 7 16:17:13 2021 +0800
[PR/target 100316] Allow constant address for __builtin___clear_cache.
__builtin___clear_cache was able to accept constant address for the
argument, but it seems no longer accept recently, and it even not
accept constant address which is hold in variable when optimization is
enable:
```
void foo3(){
void *yy = (void*)0x1000;
__builtin___clear_cache(yy, yy);
}
```
So this patch make BEGIN and END accept VOIDmode, like cselib_lookup_mem
did per
Jim Wilson's suggestion.
```
static cselib_val *
cselib_lookup_mem (rtx x, int create)
{
...
addr_mode = GET_MODE (XEXP (x, 0));
if (addr_mode == VOIDmode)
addr_mode = Pmode;
```
Changes v2 -> v3:
- Use gcc_assert rather than error, maybe_emit_call_builtin___clear_cache
is
internal use only, and we already checked the type in other place.
Changes v1 -> v2:
- Check is CONST_INT intead of cehck mode, no new testcase, since
constant value with other type like CONST_DOUBLE will catched by
front-end.
e.g.
Code:
```c
void foo(){
__builtin___clear_cache(1.11, 0);
}
```
Error message:
```
clearcache-double.c: In function 'foo':
clearcache-double.c:2:27: error: incompatible type for argument 1 of
'__builtin___clear_cache'
2 | __builtin___clear_cache(1.11, 0);
| ^~~~
| |
| double
clearcache-double.c:2:27: note: expected 'void *' but argument is of type
'double'
```
gcc/ChangeLog:
PR target/100316
* builtins.c (maybe_emit_call_builtin___clear_cache): Allow
CONST_INT for BEGIN and END, and use gcc_assert rather than
error.
gcc/testsuite/ChangeLog:
PR target/100316
* gcc.c-torture/compile/pr100316.c: New.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
` (2 preceding siblings ...)
2021-10-11 6:15 ` cvs-commit at gcc dot gnu.org
@ 2021-10-11 6:28 ` kito at gcc dot gnu.org
2021-10-18 16:05 ` cvs-commit at gcc dot gnu.org
2021-10-18 16:06 ` kito at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: kito at gcc dot gnu.org @ 2021-10-11 6:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
Kito Cheng <kito at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kito at gcc dot gnu.org
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |kito at gcc dot gnu.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
` (3 preceding siblings ...)
2021-10-11 6:28 ` kito at gcc dot gnu.org
@ 2021-10-18 16:05 ` cvs-commit at gcc dot gnu.org
2021-10-18 16:06 ` kito at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-18 16:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Kito Cheng <kito@gcc.gnu.org>:
https://gcc.gnu.org/g:aa827fa170d3e61d17c3daaf4d5008a3c674a005
commit r11-9170-gaa827fa170d3e61d17c3daaf4d5008a3c674a005
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Thu Oct 7 16:17:13 2021 +0800
[PR/target 100316] Allow constant address for __builtin___clear_cache.
__builtin___clear_cache was able to accept constant address for the
argument, but it seems no longer accept recently, and it even not
accept constant address which is hold in variable when optimization is
enable:
```
void foo3(){
void *yy = (void*)0x1000;
__builtin___clear_cache(yy, yy);
}
```
So this patch make BEGIN and END accept VOIDmode, like cselib_lookup_mem
did per
Jim Wilson's suggestion.
```
static cselib_val *
cselib_lookup_mem (rtx x, int create)
{
...
addr_mode = GET_MODE (XEXP (x, 0));
if (addr_mode == VOIDmode)
addr_mode = Pmode;
```
Changes v2 -> v3:
- Use gcc_assert rather than error, maybe_emit_call_builtin___clear_cache
is
internal use only, and we already checked the type in other place.
Changes v1 -> v2:
- Check is CONST_INT intead of cehck mode, no new testcase, since
constant value with other type like CONST_DOUBLE will catched by
front-end.
e.g.
Code:
```c
void foo(){
__builtin___clear_cache(1.11, 0);
}
```
Error message:
```
clearcache-double.c: In function 'foo':
clearcache-double.c:2:27: error: incompatible type for argument 1 of
'__builtin___clear_cache'
2 | __builtin___clear_cache(1.11, 0);
| ^~~~
| |
| double
clearcache-double.c:2:27: note: expected 'void *' but argument is of type
'double'
```
gcc/ChangeLog:
PR target/100316
* builtins.c (maybe_emit_call_builtin___clear_cache): Allow
CONST_INT for BEGIN and END, and use gcc_assert rather than
error.
gcc/testsuite/ChangeLog:
PR target/100316
* gcc.c-torture/compile/pr100316.c: New.
(cherry picked from commit 4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
` (4 preceding siblings ...)
2021-10-18 16:05 ` cvs-commit at gcc dot gnu.org
@ 2021-10-18 16:06 ` kito at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: kito at gcc dot gnu.org @ 2021-10-18 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316
Kito Cheng <kito at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Kito Cheng <kito at gcc dot gnu.org> ---
Fixed are committed to both trunk and gcc-11 branch now :)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-10-18 16:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 12:35 [Bug target/100316] New: Regression: __clear_cache() does not support NULL-pointer arguments christophm30 at gmail dot com
2021-04-28 21:23 ` [Bug target/100316] " wilson at gcc dot gnu.org
2021-10-07 10:31 ` [Bug middle-end/100316] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-10-11 6:15 ` cvs-commit at gcc dot gnu.org
2021-10-11 6:28 ` kito at gcc dot gnu.org
2021-10-18 16:05 ` cvs-commit at gcc dot gnu.org
2021-10-18 16:06 ` kito 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).