https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
Matthieu Brucher changed:
What|Removed |Added
Status|RESOLVED|REOPENED
Resolution|WORKSFORM
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #19 from Matthieu Brucher ---
That was my original comment... Thanks for quoting me...
The issue is that the warning doesn't tell me what you told me, that "this" is
never equal to nullptr in that context. This is what the warning sho
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #17 from Matthieu Brucher ---
Not everyone runs this sanitizer, and not everyone has unit tests that can find
this error (the application I woked on that had this has numerous unit tests,
but this was not tested because the guy that w
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #15 from Matthieu Brucher ---
Thanks, finally something relevant, yes it's a bug that can be easilly checked
by gcc and that GCC can easilly warn about. (lowering the bar here). Yes, the
user should chase the bug because they screwep
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
Matthieu Brucher changed:
What|Removed |Added
Status|RESOLVED|REOPENED
Resolution|INVALID
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #11 from Matthieu Brucher ---
Oh, and if this is always false, why isn't it the case in debug mode? It is
then a bug according to what you said.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #10 from Matthieu Brucher ---
If it is always false, what impeds you for warning as such? Because numerous
people are checking this (and I agree that they shouldn't), as proven by my 2
links.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #8 from Matthieu Brucher ---
In a header:
class Foo
{
public:
void bar();
};
Inthe corresponding source:
#include
void Foo::bar()
{
if(this)
{
std::cout << "Pointer is not null";
}
else
{
std::cout << "Pointer i
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #6 from Matthieu Brucher ---
I never said that the test alone should be banned. Please read the original
message first.
I said that if(!this) in the context of a method gives "unexpected" behavior
(according to the standard and the di
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #4 from Matthieu Brucher ---
I would agree if the debug and optimized versions had the same behavior. They
do not. As such there should be a huge warning about the undefined behavior.
And no, it's not valid code, it's an undefined b
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #2 from Matthieu Brucher ---
No, I think the optimization is more than correct.
The warning doesn't warn of the actual problem, if you check against nullptr,
you won't even get a warning.
Comparing this to anything from Null to null
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: matthieu.brucher at gmail dot com
Target Milestone: ---
The constructs if(!this) in a method raises a warning about comparison with
NULL, as it should.
We agree that this is an undefined
12 matches
Mail list logo