[PATCH] D27038: [XRay][compiler-rt] XRay Flight Data Recorder Mode

Martin Pelikán via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 08:44:34 PST 2017


pelikan added inline comments.


================
Comment at: lib/xray/xray_fdr_logging.h:37
+  // A MetadataRecord must always have a type of 1.
+  RecordType Type : 1;
+
----------------
pelikan wrote:
> rSerge wrote:
> > dberris wrote:
> > > pelikan wrote:
> > > > In file included from /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.cc:17:0:
> > > > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:37:21: warning: ‘__xray::MetadataRecord::Type’ is too small to hold all values of ‘enum class __xray::RecordType’
> > > >    RecordType Type : 1;
> > > >                      ^
> > > > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:48:28: warning: ‘__xray::MetadataRecord::RecordKind’ is too small to hold all values of ‘enum class __xray::MetadataRecord::RecordKinds’
> > > >    RecordKinds RecordKind : 7; // Use 7 bits to identify this record type.
> > > >                             ^
> > > > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:56:21: warning: ‘__xray::FunctionRecord::Type’ is too small to hold all values of ‘enum class __xray::RecordType’
> > > >    RecordType Type : 1;
> > > >                      ^
> > > > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:62:28: warning: ‘__xray::FunctionRecord::RecordKind’ is too small to hold all values of ‘enum class __xray::FunctionRecord::RecordKinds’
> > > >    RecordKinds RecordKind : 3;
> > > > 
> > > > Is this a gcc (6.3.0 used) bug?
> > > Unsure whether this is a bug, but that's a good question. RecordType is an enum class whose base is an unsigned 8-bit integral type -- and only has two values. 1 bit ought to be enough, no?
> > Does the warning disappear if the integer values for enum members are specified explicitly?
> It does not disappear.  It appears to be a genuine bug.  I'll try with the trunk GCC and then file a minimal case as a bug report.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414 was there already, since 2014.  Sigh.


https://reviews.llvm.org/D27038





More information about the llvm-commits mailing list