Page MenuHomePhabricator

soumitra (Soumitra Chatterjee)
User

Projects

User does not belong to any projects.

User Details

User Since
Jun 21 2015, 9:00 PM (414 w, 4 d)

Recent Activity

Mar 28 2022

soumitra updated the diff for D122469: OpenMP 5.1 - Support 'seq_cst' clause on 'flush' directive.

The previous patch had unrelated changes inadvertently. Corrected.

Mar 28 2022, 3:14 AM · Restricted Project, Restricted Project, Restricted Project

Mar 25 2022

soumitra requested review of D122469: OpenMP 5.1 - Support 'seq_cst' clause on 'flush' directive.
Mar 25 2022, 3:09 AM · Restricted Project, Restricted Project, Restricted Project

Dec 22 2021

soumitra added inline comments to D115919: SIGSEGV in Sanitizer INTERCEPTOR of strstr function..
Dec 22 2021, 9:19 PM · Restricted Project, Restricted Project
soumitra added a comment to D115919: SIGSEGV in Sanitizer INTERCEPTOR of strstr function..

hm, according to this it's Undefined Behavior
Sanitizer should probably crash in this case, at least with strict_string_checks
https://en.cppreference.com/w/c/string/byte/strstr

Instead, why should the sanitizer not diagnose the use of undefined behavior?
It would be good for the sanitizer to emit a diagnostic about "undefined behavior" (probably a warning). Code that leads to undefined behavior is generally not portable and is a bad programing practice that should be avoided.

Dec 22 2021, 8:07 PM · Restricted Project, Restricted Project

Sep 3 2015

soumitra added inline comments to D12226: [LLD] Support for --unresolved-symbols option in llvm lld for ELF file format.
Sep 3 2015, 3:56 AM

Aug 3 2015

soumitra added a comment to D10634: Loss of Sign Checker.

I am leaning toward allowing explicit assignments to "-1", like in this case: "unsigned int j = -1". The tool is much more usable if there are few false positives.

This is exactly what I started off with, albeit with a plain 'char' instead of 'unsigned int'. We were hitting a runtime issue while porting a large piece of software to AArch64 since the "signedness" of plain char changes across x86 and AArch64, and a negative value was used as a initializer.

I am also still skeptic about this. Ideally there should only be warnings when there is a mistake.

In your example code you showed previously there were portability problems because the signedness changed. A warning for that is ok in my opinion.

If the code says 'unsigned int j = -1;' then there is no such portability problem.

Ah! Now I get it!!

Aug 3 2015, 11:03 PM
soumitra added a comment to D10634: Loss of Sign Checker.

Why do you have checkASTDecl (which is a syntactic check) in addition to the checkBind (which is a path-sensitive check)? Does checkASTDecl find more issues? can those be found using a path sensitive callback?

Yes, it seems that the global assignments can only be caught using the ASTDecl checker (probably because they do not have an associated "path"?) Please do let me know in case I am wrong in my understanding.

Aug 3 2015, 9:49 PM

Jul 9 2015

soumitra added a comment to D10634: Loss of Sign Checker.

Here's a short test case that shows the problem:

Thanks!

I believe a fix for this problem would be a good thing. So that when this patch is added we don't get these false positives.

It should be a separate patch.

Sure, let me try to take a shot at it.

Jul 9 2015, 11:18 PM

Jul 7 2015

soumitra added a comment to D10634: Loss of Sign Checker.

Here is a bigger log with more warnings.
https://drive.google.com/file/d/0BykPmWrCOxt2aGtRNTY4eXQ1OU0/view

there are some cases where I don't think there should be a warning.. for instance some compound assignments:

args.c:990:9: warning: assigning negative value to unsigned variable loses sign and may cause undesired runtime behavior [clang-analyzer-alpha.core.LossOfSignAssign]

tmp /= 10;
    ^

read.c:4940:13: warning: assigning negative value to unsigned variable loses sign and may cause undesired runtime behavior [clang-analyzer-alpha.core.LossOfSignAssign]

value >>= 7;
      ^

I am not an expert but it seems strange to me that clang seems to think that 10 and 7 are negative. Can you investigate this?

Here's a short test case that shows the problem:

1  void safe_mul(unsigned long x) {
2    unsigned long multiplier = 1000000000000000000; 
3    while (x > 0) {
4      multiplier /= 10;
5    }
6  }
Jul 7 2015, 8:03 PM

Jul 6 2015

soumitra added a reviewer for D10634: Loss of Sign Checker: danielmarjamaki.
Jul 6 2015, 12:57 AM
soumitra added a comment to D10634: Loss of Sign Checker.

ftp://ftp.sunet.se/pub/Linux/distributions/Debian/debian/pool/main/a/abcm2ps/abcm2ps_7.8.9.orig.tar.gz
clang-tidy abcm2ps-7.8.9/deco.c
deco.c:788:9: warning: assigning negative value to unsigned variable loses sign and may cause undesired runtime behavior [clang-analyzer-alpha.core.LossOfSignAssign]

ps_x = -1;

Only a temporary assignment, before being assigned to "signed char" ps_func, and hence safe.

Jul 6 2015, 12:56 AM

Jul 5 2015

soumitra added a comment to D10634: Loss of Sign Checker.
Jul 5 2015, 8:29 PM
soumitra updated the diff for D10634: Loss of Sign Checker.

Incorporated further review comments by Daniel.
Working copy updated, built, and tested using check-all.

Jul 5 2015, 8:26 PM

Jul 1 2015

soumitra updated the diff for D10634: Loss of Sign Checker.

Incorporated review comments by Daniel.
Updated revisions, rebuilt, retested using check-all.

Jul 1 2015, 10:52 PM

Jun 29 2015

soumitra updated the diff for D10634: Loss of Sign Checker.

Missed updating my working copy prior to creating the patch.
Updated, Rebuilt, and tested using check-all.

Jun 29 2015, 9:55 PM
soumitra updated the test plan for D10634: Loss of Sign Checker.
Jun 29 2015, 1:33 AM
soumitra updated the test plan for D10634: Loss of Sign Checker.
Jun 29 2015, 1:33 AM
soumitra updated the diff for D10634: Loss of Sign Checker.

I had missed a check for initializer on a variable in my previous revision, resulting in a stack dump. Fixed.
Renamed the id and the test file as per Daniel's suggestion to reflect assignment.
Validated with make check-all, which I had missed earlier.

Jun 29 2015, 1:32 AM

Jun 23 2015

soumitra added a comment to D10634: Loss of Sign Checker.

I recommend a more specific name than LossOfSignChecker unless you want it to have more warnings later. Right now, a name such as LossOfSignInAssignmentChecker.cpp would be better imho.

I don't have immediate plans to add more warnings on this, but there definitely are many more cases where we can lose the sign and potentially cause runtime failures.

Jun 23 2015, 3:03 AM

Jun 22 2015

soumitra retitled D10634: Loss of Sign Checker from to Loss of Sign Checker.
Jun 22 2015, 10:21 PM