[PATCH] D105023: [NFC][AIX][XCOFF][Bug-Fixed] parse the parameter type of the traceback table.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 06:33:58 PDT 2021


DiggerLin created this revision.
DiggerLin added reviewers: jasonliu, hubert.reinterpretcast.
Herald added subscribers: hiraditya, kristof.beyls.
DiggerLin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

1. in the function  **//PPCFunctionInfo::getParmsType(), //** there is **//if (Bits > 31 || (Bits > 30 && (Elt != FixedType || hasVectorParms())))//**

  when the Bit is 31 and the Elt is not FixedType(for example the Elt is FloatingType) , the 31th bit will be not encoded,  it leave the bit as zero, when the function  **//Expected<SmallString<32>> XCOFF::parseParmsType() //** the original implement

**//   unsigned ParmsNum = FixedParmsNum + FloatingParmsNum;

  while (Bits < 32 && ParsedNum < ParmsNum) {
  ...
  }//**
  it will look the 31 bits (zero) as FixedType. which should be FloatingType,  and get a error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105023

Files:
  llvm/lib/BinaryFormat/XCOFF.cpp


Index: llvm/lib/BinaryFormat/XCOFF.cpp
===================================================================
--- llvm/lib/BinaryFormat/XCOFF.cpp
+++ llvm/lib/BinaryFormat/XCOFF.cpp
@@ -115,9 +115,9 @@
   unsigned ParsedFixedNum = 0;
   unsigned ParsedFloatingNum = 0;
   unsigned ParsedNum = 0;
-  unsigned ParmsNum = FixedParmsNum + FloatingParmsNum;
 
-  while (Bits < 32 && ParsedNum < ParmsNum) {
+  while (Bits < 32 && ParsedFixedNum <= FixedParmsNum &&
+         ParsedFloatingNum <= FloatingParmsNum) {
     if (++ParsedNum > 1)
       ParmsType += ", ";
     if ((Value & TracebackTable::ParmTypeIsFloatingBit) == 0) {
@@ -140,11 +140,10 @@
   }
 
   // We have more parameters than the 32 Bits could encode.
-  if (ParsedNum < ParmsNum)
+  if (ParsedNum < FixedParmsNum + FloatingParmsNum)
     ParmsType += ", ...";
 
-  if (Value != 0u || ParsedFixedNum > FixedParmsNum ||
-      ParsedFloatingNum > FloatingParmsNum)
+  if (Value != 0u)
     return createStringError(errc::invalid_argument,
                              "ParmsType encodes can not map to ParmsNum "
                              "parameters in parseParmsType.");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105023.354875.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210628/e0c1008c/attachment.bin>


More information about the llvm-commits mailing list