c-semantics icon indicating copy to clipboard operation
c-semantics copied to clipboard

kcc can't generate report for enchive

Open Lycbel opened this issue 7 years ago • 0 comments

kcc can compile enchive : https://github.com/skeeto/enchive commit 3f1910cb0c7ed30ee09a293ca0a91e2b57486722 but when set the -fissue-report flag to generate the report it will have the error:

... <some UBs> ...
Fatal error: out of memory.

platform info:

ubuntu 16.04 on VMware 5GB memory 
java: 
	java version "1.8.0_181"
	Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
	Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

kcc: 	kcc: version 1.0 GNU-compatible

	Build number: 07dcaa9-1541738973679
	Current profile: x86_64-linux-gcc-glibc
	Installed profiles: x86_64-linux-gcc-glibc-gnuc-reverse-eval-order
	                    x86_64-linux-gcc-glibc-gnuc
	                    x86_64-linux-gcc-glibc
	                    x86-gcc-limited-libc
	                    x86_64-linux-gcc-glibc-reverse-eval-order
	Default profile: x86_64-linux-gcc-glibc

make:
	GNU Make 4.1
	Built for x86_64-pc-linux-gnu
	Copyright (C) 1988-2014 Free Software Foundation, Inc.

the zip file enchive contains: the enchive project; run.sh to regenerate the problem; and the generated output"output_with_report.txt"

to regenerate the problem can:

wget https://github.com/Lycbel/cs510Files/blob/master/report6/enchive/enchive.zip?raw=true -O enchive.zip
unzip enchive.zip
cd enchive
bash run.sh

Possible reason: Maybe the problem is the UBs are too many If we choose to not generate report, it can finish running the test and print out all the UBs. The output file is "output_without_report.txt". You can see it contains lots of UBs which are kind of duplicated. one reason why it is duplicated: there are many extremely similar codes and "<<" operation is super common in this project. for example:

  output[8] += output[18] << 4;
  output[8] += output[18] << 1;
  output[8] += output[18];
  output[7] += output[17] << 4;
  output[7] += output[17] << 1;

each line of code might be called multiple times ( like 40 more times of different call back stacks, when UBs occurs ) take instance of the UB: "The left operand in a bitwise right-shift is negative" each line of code will have more than 40 UBs and there are many similar conditions having many duplicated patterns which have UB.

Such thing is not very "clever" as it provided many duplicated information. and maybe it is the cause of out of memory.

Lycbel avatar Nov 26 '18 09:11 Lycbel