* [Bug other/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
@ 2023-09-22 19:09 ` sjames at gcc dot gnu.org
2023-09-22 19:51 ` seurer at gcc dot gnu.org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-22 19:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
Maybe attach a preprocessed version for completeness?
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug other/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
2023-09-22 19:09 ` [Bug other/111544] " sjames at gcc dot gnu.org
@ 2023-09-22 19:51 ` seurer at gcc dot gnu.org
2023-09-22 20:04 ` [Bug c++/111544] " pinskia at gcc dot gnu.org
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: seurer at gcc dot gnu.org @ 2023-09-22 19:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #2 from seurer at gcc dot gnu.org ---
I can't attach the whole thing but I am working on cutting it down.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
2023-09-22 19:09 ` [Bug other/111544] " sjames at gcc dot gnu.org
2023-09-22 19:51 ` seurer at gcc dot gnu.org
@ 2023-09-22 20:04 ` pinskia at gcc dot gnu.org
2023-09-22 20:11 ` sjames at gcc dot gnu.org
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-22 20:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|other |c++
Keywords|rejects-valid |
Target Milestone|--- |14.0
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am suspecting it is invalid code but maybe we should accept for -fpermissive
if possible ...
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (2 preceding siblings ...)
2023-09-22 20:04 ` [Bug c++/111544] " pinskia at gcc dot gnu.org
@ 2023-09-22 20:11 ` sjames at gcc dot gnu.org
2023-09-22 20:16 ` sjames at gcc dot gnu.org
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-22 20:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
Am trying to build xerces-c-2.5.0 but am struggling for other reasons due to
its age...
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (3 preceding siblings ...)
2023-09-22 20:11 ` sjames at gcc dot gnu.org
@ 2023-09-22 20:16 ` sjames at gcc dot gnu.org
2023-09-22 20:23 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-22 20:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 55969
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55969&action=edit
DGXMLScanner.ii
Reproduced w/ DGXMLScanner.ii
1. wget
https://archive.apache.org/dist/xml/xerces-c/Xerces-C_2_5_0/xerces-c-src_2_5_0.tar.gz
2. tar ... && cd xerces*
3. export XERCESCROOT=$(pwd)
4. cd src/xercesc && ./configure && make -j1
```
# c++ -fPIC -DLINUX -D_REENTRANT -c
-I/root/xerces-c-src_2_5_0/src/xercesc/../../include -g -O2 -o
/root/xerces-c-src_2_5_0/src/xercesc/../../obj/LINUX/DGXMLScanner.o
DGXMLScanner.cpp -save-temps
In file included from
/root/xerces-c-src_2_5_0/src/xercesc/../../include/xercesc/util/NameIdPool.hpp:338,
from
/root/xerces-c-src_2_5_0/src/xercesc/../../include/xercesc/internal/XMLScanner.hpp:311,
from
/root/xerces-c-src_2_5_0/src/xercesc/../../include/xercesc/internal/DGXMLScanner.hpp:102,
from DGXMLScanner.cpp:65:
/root/xerces-c-src_2_5_0/src/xercesc/../../include/xercesc/util/NameIdPool.c:
In member function ‘xercesc_2_5::NameIdPoolEnumerator<TElem>&
xercesc_2_5::NameIdPoolEnumerator<TElem>::operator=(const
xercesc_2_5::NameIdPoolEnumerator<TElem>&)’:
/root/xerces-c-src_2_5_0/src/xercesc/../../include/xercesc/util/NameIdPool.c:416:20:
error: assignment of read-only location
‘((xercesc_2_5::NameIdPoolEnumerator<TElem>*)this)->xercesc_2_5::NameIdPoolEnumerator<TElem>::fMemoryManager’
416 | fMemoryManager = toAssign.fMemoryManager;
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
```
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (4 preceding siblings ...)
2023-09-22 20:16 ` sjames at gcc dot gnu.org
@ 2023-09-22 20:23 ` pinskia at gcc dot gnu.org
2023-09-22 20:32 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-22 20:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MemoryManager* const fMemoryManager;
So reduced:
```
template <int>
struct a
{
int * const t;
void f();
};
template <int n>
void a<n>::f()
{
t = 0;
}
```
Yes this is invalid code that GCC accepted before.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (5 preceding siblings ...)
2023-09-22 20:23 ` pinskia at gcc dot gnu.org
@ 2023-09-22 20:32 ` pinskia at gcc dot gnu.org
2023-09-22 20:34 ` sjames at gcc dot gnu.org
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-22 20:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually this is the reduced testcase:
```
struct bs
{
int * const t;
};
template <int n>
struct a
{
int * const t;
a &f(const a&, int *const tt, const a *c, const bs&);
};
template <int n>
a<n> & a<n>::f(const a &b, int *const tt, const a *c, const bs &d)
{
t = c->t;
t = b.t;
// t = d.t;
// t = tt;
return *this;
}
```
clang accepts each of the above statements except for the commented out ones.
Not even in pedantic mode they reject them.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (6 preceding siblings ...)
2023-09-22 20:32 ` pinskia at gcc dot gnu.org
@ 2023-09-22 20:34 ` sjames at gcc dot gnu.org
2023-09-22 20:47 ` sjames at gcc dot gnu.org
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-22 20:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #8 from Sam James <sjames at gcc dot gnu.org> ---
https://github.com/apache/xerces-c/commit/bc3189892c2e700bd3298b77cd8a523080fa74bb
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (7 preceding siblings ...)
2023-09-22 20:34 ` sjames at gcc dot gnu.org
@ 2023-09-22 20:47 ` sjames at gcc dot gnu.org
2023-09-22 21:00 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-09-22 20:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #9 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #8)
> https://github.com/apache/xerces-c/commit/
> bc3189892c2e700bd3298b77cd8a523080fa74bb
https://issues.apache.org/jira/projects/XERCESC/issues/XERCESC-1259
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (8 preceding siblings ...)
2023-09-22 20:47 ` sjames at gcc dot gnu.org
@ 2023-09-22 21:00 ` pinskia at gcc dot gnu.org
2023-09-22 21:17 ` seurer at gcc dot gnu.org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-22 21:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> Actually this is the reduced testcase:
> ```
> struct bs
> {
> int * const t;
> };
> template <int n>
> struct a
> {
> int * const t;
> a &f(const a&, int *const tt, const a *c, const bs&);
> };
>
> template <int n>
> a<n> & a<n>::f(const a &b, int *const tt, const a *c, const bs &d)
> {
> t = c->t;
> t = b.t;
> // t = d.t;
> // t = tt;
> return *this;
> }
> ```
>
> clang accepts each of the above statements except for the commented out
> ones. Not even in pedantic mode they reject them.
Clang does reject it if it is instantiated:
```
void g(a<1> &a1, bs &d)
{
a1.f(a1,nullptr,&a1, d);
}
```
So clang most likely thinks b.t and c->t are still type depedent even though
they don't need to be ...
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (9 preceding siblings ...)
2023-09-22 21:00 ` pinskia at gcc dot gnu.org
@ 2023-09-22 21:17 ` seurer at gcc dot gnu.org
2023-09-24 9:41 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: seurer at gcc dot gnu.org @ 2023-09-22 21:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #11 from seurer at gcc dot gnu.org ---
From, the original I cut it down to this. Compiles OK with r14-4110, error
with r14-4111.
bad3.c: In member function 'NameIdPoolEnumerator<TElem>&
NameIdPoolEnumerator<TElem>::operator=(const NameIdPoolEnumerator<TElem>&)':
bad3.c:23:20: error: assignment of read-only location
'((NameIdPoolEnumerator<TElem>*)this)->NameIdPoolEnumerator<TElem>::fMemoryManager'
23 | fMemoryManager = toAssign.fMemoryManager;
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
class MemoryManager;
template <class TElem> class NameIdPoolEnumerator// : public XMemory
{
public :
NameIdPoolEnumerator<TElem>& operator=
(
const NameIdPoolEnumerator<TElem>& toAssign
);
private :
MemoryManager* const fMemoryManager;
};
template <class TElem> NameIdPoolEnumerator<TElem>&
NameIdPoolEnumerator<TElem>::
operator=(const NameIdPoolEnumerator<TElem>& toAssign)
{
fMemoryManager = toAssign.fMemoryManager;
return *this;
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (10 preceding siblings ...)
2023-09-22 21:17 ` seurer at gcc dot gnu.org
@ 2023-09-24 9:41 ` redi at gcc dot gnu.org
2023-09-24 9:41 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-24 9:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #10)
> So clang most likely thinks b.t and c->t are still type depedent even though
> they don't need to be ...
Which is fine. It's QoI whether non-dependent errors in uninstantiated
templates are diagnosed. So Clang is not wrong to accept it. And GCC is not
wrong to reject it.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (11 preceding siblings ...)
2023-09-24 9:41 ` redi at gcc dot gnu.org
@ 2023-09-24 9:41 ` redi at gcc dot gnu.org
2023-10-10 17:49 ` seurer at gcc dot gnu.org
2024-01-17 17:53 ` sjames at gcc dot gnu.org
14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-24 9:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
But the code is "ill-formed, no diagnostic required" and GCC is now being more
helpful by diagnosing it.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (12 preceding siblings ...)
2023-09-24 9:41 ` redi at gcc dot gnu.org
@ 2023-10-10 17:49 ` seurer at gcc dot gnu.org
2024-01-17 17:53 ` sjames at gcc dot gnu.org
14 siblings, 0 replies; 16+ messages in thread
From: seurer at gcc dot gnu.org @ 2023-10-10 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
seurer at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #14 from seurer at gcc dot gnu.org ---
I modified the code to remove the "const" as that what was done to xerces
itself.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/111544] [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b
2023-09-22 18:59 [Bug other/111544] New: [14 regression] assignment of read-only location after r14-4111-g6e92a6a2a72d3b seurer at gcc dot gnu.org
` (13 preceding siblings ...)
2023-10-10 17:49 ` seurer at gcc dot gnu.org
@ 2024-01-17 17:53 ` sjames at gcc dot gnu.org
14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-01-17 17:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111544
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |macro at orcam dot me.uk
--- Comment #15 from Sam James <sjames at gcc dot gnu.org> ---
*** Bug 113454 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 16+ messages in thread