public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable
@ 2023-02-27 19:56 piotr5 at netscape dot net
2023-02-27 20:03 ` [Bug c++/108955] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: piotr5 at netscape dot net @ 2023-02-27 19:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108955
Bug ID: 108955
Summary: Ultimate++ fails with its specialized AssertMoveable
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: piotr5 at netscape dot net
Target Milestone: ---
Created attachment 54548
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54548&action=edit
my failed attempt at a minimal example after preprocessor
I'm on gentoo with sys-devel/gcc-13.0.1_pre20230219 and tried to recompile
anything using Ultimate++ from upp.sf.net and already the heaqders fail to
compile. error: invalid type argument of unary '*' (have 'unsigned int')
this indicates the pre-c++11 test for "unsigned int" being a moveable data-type
failed. I tried to reproduce the problem with a minimal example but that had no
such problems in compilation. the way it's supposed to work is Core/Topt.h:
```
template <class T>
inline void AssertMoveablePtr(T, T) {}
template <class T>
inline void AssertMoveable0(T *t) { AssertMoveablePtr(&**t, *t); }
// COMPILATION ERROR HERE MEANS TYPE T WAS NOT MARKED AS Moveable
template <class T>
struct Moveable_ {
friend void AssertMoveable0(T *) {}
};
template <class T>
inline void AssertMoveable(T *t = 0) { if(t) AssertMoveable0(t); }
#if defined(COMPILER_MSC) || defined(COMPILER_GCC) && (__GNUC__ < 4 ||
__GNUC_MINOR__ < 1)
#define NTL_MOVEABLE(T) inline void AssertMoveable0(T *) {}
#else
#define NTL_MOVEABLE(T) template<> inline void AssertMoveable<T>(T *)
{}
#endif
NTL_MOVEABLE(bool)
NTL_MOVEABLE(char)
NTL_MOVEABLE(signed char)
NTL_MOVEABLE(unsigned char)
NTL_MOVEABLE(short)
NTL_MOVEABLE(unsigned short)
NTL_MOVEABLE(int)
NTL_MOVEABLE(unsigned int)
NTL_MOVEABLE(long)
NTL_MOVEABLE(unsigned long)
NTL_MOVEABLE(int64)
NTL_MOVEABLE(uint64)
NTL_MOVEABLE(float)
NTL_MOVEABLE(double)
NTL_MOVEABLE(void *)
NTL_MOVEABLE(const void *)
```
then in destructor for Vector there is
AssertMoveable((T *)0);
where T = unsigned int
what is supposed to happen is that NTL_MOVEABLE expands to
template<> inline void AssertMoveable<T>(T *) {}
so far it works as expected. however upon encontering that AssertMoveable((T
*)0); it is expanded into
inline void AssertMoveable0(T *t) { AssertMoveablePtr(&**t, *t); }
instead. is it because that was defined in the wrong order? but then why did my
minimal example work? why is there no such problem with gcc-12?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108955] Ultimate++ fails with its specialized AssertMoveable
2023-02-27 19:56 [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable piotr5 at netscape dot net
@ 2023-02-27 20:03 ` pinskia at gcc dot gnu.org
2023-02-27 20:19 ` piotr5 at netscape dot net
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-27 20:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108955
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2023-02-27
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you attach the preprocessed source of the non-minimal example? Since it is
not obvious what is going wrong ...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108955] Ultimate++ fails with its specialized AssertMoveable
2023-02-27 19:56 [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable piotr5 at netscape dot net
2023-02-27 20:03 ` [Bug c++/108955] " pinskia at gcc dot gnu.org
@ 2023-02-27 20:19 ` piotr5 at netscape dot net
2023-02-27 20:32 ` pinskia at gcc dot gnu.org
2023-02-27 20:36 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: piotr5 at netscape dot net @ 2023-02-27 20:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108955
--- Comment #2 from piotr5 at netscape dot net ---
Created attachment 54549
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54549&action=edit
gunzip then: c++-13 -c delme-E13.cxx
also fails with c++-12 so the problem must be in the preprocessor...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108955] Ultimate++ fails with its specialized AssertMoveable
2023-02-27 19:56 [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable piotr5 at netscape dot net
2023-02-27 20:03 ` [Bug c++/108955] " pinskia at gcc dot gnu.org
2023-02-27 20:19 ` piotr5 at netscape dot net
@ 2023-02-27 20:32 ` pinskia at gcc dot gnu.org
2023-02-27 20:36 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-27 20:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108955
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|WAITING |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code is definitely invalid.
How to fix it is to move this:
template <class T>
inline void AssertMoveable(T *t = 0) { if(t) AssertMoveable0(t); }
Below the definitions of AssertMoveable0.
(__GNUC__ < 4 || __GNUC_MINOR__ < 1)
That is check is just wrong. Especially while GCC 13.0.1 is a stage 4 compiler.
Maybe it should be just:
__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108955] Ultimate++ fails with its specialized AssertMoveable
2023-02-27 19:56 [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable piotr5 at netscape dot net
` (2 preceding siblings ...)
2023-02-27 20:32 ` pinskia at gcc dot gnu.org
@ 2023-02-27 20:36 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-27 20:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108955
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> The code is definitely invalid.
>
> How to fix it is to move this:
> template <class T>
> inline void AssertMoveable(T *t = 0) { if(t) AssertMoveable0(t); }
>
>
> Below the definitions of AssertMoveable0.
> (__GNUC__ < 4 || __GNUC_MINOR__ < 1)
>
> That is check is just wrong. Especially while GCC 13.0.1 is a stage 4
> compiler.
>
> Maybe it should be just:
> __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)
That is if this is GCC before GCC 4.1.0 do it differently.
The reason why not many people hit this is because the first official release
of a major release of GCC these days is N.1.0 and you would only hit this
during the development of the trunk ...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-27 20:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 19:56 [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable piotr5 at netscape dot net
2023-02-27 20:03 ` [Bug c++/108955] " pinskia at gcc dot gnu.org
2023-02-27 20:19 ` piotr5 at netscape dot net
2023-02-27 20:32 ` pinskia at gcc dot gnu.org
2023-02-27 20:36 ` pinskia 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).