Thanks, Changchun. I have just a few more questions to try to debug the
problem:
- What version of g++ are you using? (g++ --version should tell you)
- What architecture are you building for?
- Could you send the generated code around line 266 in demo.pb.h just so
that it's clear what lines the compiler is warning about?

On Mon, Nov 14, 2016 at 7:55 AM, <changchunzhao.t...@gmail.com> wrote:

> Adam, Thanks for your reply.
>
> Here I attached a simple .proto file to demonstrate this warning message:
>
> $ protobuf-3.1/bin/protoc --cpp_out=. demo.proto
>
> $ /usr/bin/g++ -Iprotobuf-3.1/include -c -Wall -O2 -Wno-long-long demo.pb.
> cc -o demo.pb.o
> In member function 'virtual bool demo::DemoMessage::MergePartia
> lFromCodedStream(google::protobuf::io::CodedInputStream*)':
> cc1plus: warning: dereferencing pointer 'prephitmp.1630' does break strict
> -aliasing rules
> demo.pb.h:266: note: initialized from here
> cc1plus: note: initialized from here
>
> Please let me know if anything else you need to debug further.
>
> Thanks,
> Changchun
>
> On Friday, November 11, 2016 at 4:45:03 PM UTC-5, Adam Cozzette wrote:
>>
>> What version of g++ are you using? Also, do you have a way of determining
>> what actual line of code the compiler is warning about there?
>>
>> I tried building with -Wstrict-aliasing=2 at commit df8390790a and saw a
>> few warnings like this:
>>
>> ./google/protobuf/generated_message_util.h:94:66: warning: dereferencing
>> type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
>>    const T& get() const { return reinterpret_cast<const T&>(union_); }
>>
>> But that doesn't look like it's quite the same warning as what you are
>> seeing.
>>
>> On Fri, Nov 11, 2016 at 12:39 PM, <changchun...@gmail.com> wrote:
>>
>>> I have below option in my .proto file:
>>>
>>> *option cc_enable_arenas = true;*
>>>
>>> But g++ for Linux gives below warning:
>>>
>>> *cc1plus: warning: dereferencing pointer 'prephitmp.4925' does break
>>> strict-aliasing rules*
>>>
>>> Will this cause issue and how to solve it?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to protobuf+u...@googlegroups.com.
>>> To post to this group, send email to prot...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/protobuf.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to