* -fanalyzer triggers on empty vector of strings and foreach loop
@ 2020-05-01 21:57 andre maute
2020-05-02 11:24 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: andre maute @ 2020-05-01 21:57 UTC (permalink / raw)
To: gcc-help
I wonder if this is expected behavior
this is on a recent fedora 32 x86_64 system
g++ (GCC) 10.0.1 20200328 (Red Hat 10.0.1-0.11)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To trigger a lengthy list of deductions, I use the following three files and
g++ -fanalyzer main.cpp line.cpp
Using only the given warning flag triggers nothing
g++ -Wanalyzer-null-dereference main.cpp line.cpp
///// begin of main.cpp ///////////
#include <string>
#include <vector>
#include "line.h"
int main()
{
std::vector<std::string> m_Text;
std::vector<Line> m_Lines;
for( const auto& line : m_Text ) {
m_Lines.emplace_back(line);
}
return 0;
}
///// end of main.cpp /////////////
///// begin of line.h ///////////
#ifndef LINE_H
#define LINE_H
#include <string>
class Line
{
public:
explicit
Line(
const std::string& data
);
const std::string& data() const;
private:
std::string m_Data;
};
#endif /* LINE_H */
///// end of line.h /////////////
///// begin of line.cpp ///////////
#include "line.h"
Line::Line(
const std::string& data
)
: m_Data(data)
{}
const std::string&
Line::data() const
{
return m_Data;
}
///// end of line.cpp /////////////
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: -fanalyzer triggers on empty vector of strings and foreach loop
2020-05-01 21:57 -fanalyzer triggers on empty vector of strings and foreach loop andre maute
@ 2020-05-02 11:24 ` Jonathan Wakely
2020-05-02 17:18 ` andre maute
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2020-05-02 11:24 UTC (permalink / raw)
To: andre maute; +Cc: gcc-help
On Fri, 1 May 2020 at 23:59, andre maute wrote:
>
> I wonder if this is expected behavior
It's a known limitation that the analyzer doesn't support C++ yet.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: -fanalyzer triggers on empty vector of strings and foreach loop
2020-05-02 11:24 ` Jonathan Wakely
@ 2020-05-02 17:18 ` andre maute
2020-05-06 16:43 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: andre maute @ 2020-05-02 17:18 UTC (permalink / raw)
To: gcc-help
On 5/2/20 1:24 PM, Jonathan Wakely wrote:
> On Fri, 1 May 2020 at 23:59, andre maute wrote:
>>
>> I wonder if this is expected behavior
>
> It's a known limitation that the analyzer doesn't support C++ yet.
>
So nevertheless should these two be filed as bugs?
The first being the iteration over the empty vector.
The second the one for the warning flag given by the output of -fanalyzer
but which doesn't trigger anything if used alone.
Regards
Andre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: -fanalyzer triggers on empty vector of strings and foreach loop
2020-05-02 17:18 ` andre maute
@ 2020-05-06 16:43 ` Jonathan Wakely
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2020-05-06 16:43 UTC (permalink / raw)
To: andre maute; +Cc: gcc-help
On Sat, 2 May 2020 at 18:21, andre maute wrote:
>
> On 5/2/20 1:24 PM, Jonathan Wakely wrote:
> > On Fri, 1 May 2020 at 23:59, andre maute wrote:
> >>
> >> I wonder if this is expected behavior
> >
> > It's a known limitation that the analyzer doesn't support C++ yet.
> >
>
> So nevertheless should these two be filed as bugs?
No thank you.
> The first being the iteration over the empty vector.
The analyzer dev says "it's not worth trying -fanalyzer with C++ at
this point. Hopefully GCC 11."
> The second the one for the warning flag given by the output of -fanalyzer
> but which doesn't trigger anything if used alone.
That's expected, -Wanalyzer-null-dereference requires -fanalyzer to do anything.
> Regards
> Andre
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-06 16:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 21:57 -fanalyzer triggers on empty vector of strings and foreach loop andre maute
2020-05-02 11:24 ` Jonathan Wakely
2020-05-02 17:18 ` andre maute
2020-05-06 16:43 ` Jonathan Wakely
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).