public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
@ 2020-06-29 16:00 msebor at gcc dot gnu.org
2020-06-29 16:49 ` [Bug bootstrap/95970] " jamborm at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-06-29 16:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
Bug ID: 95970
Summary: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’
pointer null
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
Since r11-1697 Go bootstrap fails due to the following warning turned error:
In static member function ‘static Expression* Type::type_descriptor(Gogo*,
Type*)’,
inlined from ‘virtual Expression* Named_type::do_type_descriptor(Gogo*,
Named_type*)’ at /ssd/test/src/gcc/trunk/gcc/go/gofrontend/types.cc:11114:53,
inlined from ‘virtual Expression* Named_type::do_type_descriptor(Gogo*,
Named_type*)’ at /ssd/test/src/gcc/trunk/gcc/go/gofrontend/types.cc:11105:1:
/ssd/test/src/gcc/trunk/gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’
pointer null [-Wnonnull]
1474 | return type->do_type_descriptor(gogo, NULL);
The warning, issued from tree-ssa-ccp.c, is triggered by the use of the null
pointer as the first argument in the following call for the IL below.
_31 = OBJ_TYPE_REF(_30;(struct Type)0B->12) (0B, gogo_12(D), 0B);
Named_type::do_type_descriptor (struct Named_type * const this, struct Gogo *
gogo, struct Named_type * name)
{
struct Expression * D.404029;
struct Expression * ret;
bool _1;
bool _2;
bool _3;
struct Type * _4;
struct Expression * _5;
struct Named_type * iftmp.1259_6;
struct Expression * _14;
struct Expression * _17;
struct Expression * _19;
struct Expression * _20;
struct Named_type * iftmp.1259_21;
struct Named_type * iftmp.1259_22;
struct Expression * _24;
struct Expression * _25;
struct Expression * _27;
struct Expression * _28;
int (*) () * _29;
int (*) () _30;
struct Expression * _31;
<bb 2> :
_1 = this_9(D)->is_error_;
if (_1 != 0)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
_27 = Expression::make_error (this_9(D)->location_);
_28 = _27;
goto <bb 13>; [INV]
<bb 4> :
if (name_10(D) == 0B)
goto <bb 5>; [INV]
else
goto <bb 9>; [INV]
<bb 5> :
_2 = this_9(D)->is_alias_;
if (_2 != 0)
goto <bb 6>; [INV]
else
goto <bb 9>; [INV]
<bb 6> :
_3 = this_9(D)->seen_alias_;
if (_3 != 0)
goto <bb 7>; [INV]
else
goto <bb 8>; [INV]
<bb 7> :
_19 = Expression::make_error (this_9(D)->location_);
_20 = _19;
goto <bb 13>; [INV]
<bb 8> :
this_9(D)->seen_alias_ = 1;
_29 = MEM[(struct Type *)0B]._vptr.Type;
_30 = MEM[(int (*) () *)_29 + 96B];
_31 = OBJ_TYPE_REF(_30;(struct Type)0B->12) (0B, gogo_12(D), 0B);
_33 = _31;
_14 = _33;
ret_15 = _14;
this_9(D)->seen_alias_ = 0;
_17 = ret_15;
// predicted unlikely by early return (on trees) predictor.
goto <bb 13>; [INV]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
@ 2020-06-29 16:49 ` jamborm at gcc dot gnu.org
2020-06-29 17:14 ` msebor at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-06-29 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-29
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |ian at airs dot com
--- Comment #1 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I hit this today too (and it indeed prevents go bootstrap), so I guess it's
confirmed. Ian, can you have a look whether the warning is correct? I glanced
at the code only for a little while but it looks so to me.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
2020-06-29 16:49 ` [Bug bootstrap/95970] " jamborm at gcc dot gnu.org
@ 2020-06-29 17:14 ` msebor at gcc dot gnu.org
2020-06-29 17:33 ` msebor at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-06-29 17:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
I think the warning is a false positive. The problem call is introduced by
early inlining and is eliminated by path isolation, but the -Wnonnull warning
code runs before that happens (by the post_ipa_warn pass).
Here's the relevant portion of the path isolation dump showing the removal:
;; Function Named_type::do_type_descriptor
(_ZN10Named_type18do_type_descriptorE
P4GogoPS_, funcdef_no=8125, decl_uid=214219, cgraph_uid=3913,
symbol_order=4835)
Pass statistics of "isolate-paths": ----------------
...
Removing basic block 11
;; basic block 11, loop depth 0
;; pred:
_20 = MEM[(int (*) () *)_19 + 96B];
_21 = OBJ_TYPE_REF(_20;(struct Type)0B->12) (0B, gogo_9(D), 0B);
this_7(D)->seen_alias_ = 0;
goto <bb 10>; [100.00%]
;; succ: 10
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
2020-06-29 16:49 ` [Bug bootstrap/95970] " jamborm at gcc dot gnu.org
2020-06-29 17:14 ` msebor at gcc dot gnu.org
@ 2020-06-29 17:33 ` msebor at gcc dot gnu.org
2020-06-29 17:38 ` ian at airs dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-06-29 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
On second thought, I think the warning might be correct. The function it's
issued for is a static member of class Type (I at first thought it was
virtual):
Expression*
Type::type_descriptor(Gogo* gogo, Type* type)
{
return type->do_type_descriptor(gogo, NULL); <<< -Wnonnull
}
and the call to it is below:
Expression*
Named_type::do_type_descriptor(Gogo* gogo, Named_type* name)
{
if (this->is_error_)
return Expression::make_error(this->location_);
if (name == NULL && this->is_alias_)
{
if (this->seen_alias_)
return Expression::make_error(this->location_);
this->seen_alias_ = true;
Expression* ret = this->type_->type_descriptor(gogo, NULL); <<<
this->seen_alias_ = false;
return ret;
}
I'll leave it to Ian to confirm one way or the other.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
` (2 preceding siblings ...)
2020-06-29 17:33 ` msebor at gcc dot gnu.org
@ 2020-06-29 17:38 ` ian at airs dot com
2020-06-29 17:54 ` msebor at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2020-06-29 17:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
--- Comment #4 from Ian Lance Taylor <ian at airs dot com> ---
I'm having a hard time parsing the warning. It says
gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null [-Wnonnull]
The line is
return type->do_type_descriptor(gogo, NULL);
Is this trying to say that "type" may be NULL?
That's true, it can be. This does look like a bug. There must be some reason
that this code is never executed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
` (3 preceding siblings ...)
2020-06-29 17:38 ` ian at airs dot com
@ 2020-06-29 17:54 ` msebor at gcc dot gnu.org
2020-06-29 21:29 ` cvs-commit at gcc dot gnu.org
2020-06-29 21:34 ` ian at airs dot com
6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-06-29 17:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, that's what it's saying. Unfortunately, the locations of null pointer
constants isn't available in the middle end so all we have left is the function
calls they're used in.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
` (4 preceding siblings ...)
2020-06-29 17:54 ` msebor at gcc dot gnu.org
@ 2020-06-29 21:29 ` cvs-commit at gcc dot gnu.org
2020-06-29 21:34 ` ian at airs dot com
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-29 21:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Ian Lance Taylor <ian@gcc.gnu.org>:
https://gcc.gnu.org/g:9bca676cc7a1670be021567ae4a128a5082229d3
commit r11-1721-g9bca676cc7a1670be021567ae4a128a5082229d3
Author: Ian Lance Taylor <iant@golang.org>
Date: Mon Jun 29 11:30:43 2020 -0700
compiler: remove some erroneous code that was never run
The code accidentally called Type::type_descriptor rather than the
do_type_descriptor method. Calling Type::type_descriptor with a second
argument of NULL would always crash. Since that never happened,
it revealed that this code was never actually executed.
Fixes PR go/95970
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/240477
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug bootstrap/95970] gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
` (5 preceding siblings ...)
2020-06-29 21:29 ` cvs-commit at gcc dot gnu.org
@ 2020-06-29 21:34 ` ian at airs dot com
6 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2020-06-29 21:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95970
Ian Lance Taylor <ian at airs dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #7 from Ian Lance Taylor <ian at airs dot com> ---
Should be fixed now.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-06-29 21:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 16:00 [Bug bootstrap/95970] New: gcc/go/gofrontend/types.cc:1474:34: warning: ‘this’ pointer null msebor at gcc dot gnu.org
2020-06-29 16:49 ` [Bug bootstrap/95970] " jamborm at gcc dot gnu.org
2020-06-29 17:14 ` msebor at gcc dot gnu.org
2020-06-29 17:33 ` msebor at gcc dot gnu.org
2020-06-29 17:38 ` ian at airs dot com
2020-06-29 17:54 ` msebor at gcc dot gnu.org
2020-06-29 21:29 ` cvs-commit at gcc dot gnu.org
2020-06-29 21:34 ` ian at airs dot com
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).