This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 57880


Hi,

submitter ran a static analysis tool on parser.c and found in the main switch of cp_parser_operator some broken cases having to do with user defined literals. When I looked into it I found a rather convoluted logic which tried to possibly emit *both* the error message for and invalid encoding prefix (as tested in udlit-enc-prefix-neg.C) and the error message for non-empty string after 'operator' (untested in the testsuite) before returning error_mark_node. Then when only the former was appropriate, it was emitted twice. The second missed cases - too big string_len.

Now, I don't think it should be so common that the user code has both issues in the same user defined literal (in that case providing both error messages at once would make debugging quicker), thus in the below I decided to simplify everything and immediately return error_mark_node after any error along the way.

Tested x86_64-linux.

Thanks,
Paolo.

////////////////////////

Attachment: CL_57880
Description: Text document

Attachment: patch_57880
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]