You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current C parser crashes when there are Doxygen group comments in the C code. This issue can be reproduced with the latest version of Ultimate Automizer (0.2.4-dev-1ececfe with OpenJDK 11.0.23) using the following input:
//#SAFE
typedef long unsigned int __uint32_t;
typedef __uint32_t uint32_t;
/** \ingroup CMSIS_Core_FunctionInterface
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
@{
*/
/**
\brief Get Control Register
\details Returns the content of the Control Register.
\return Control Register value
*/
static inline uint32_t __get_CONTROL(void)
{
uint32_t result;
__asm volatile ("MRS %0, control" : "=r" (result) );
return(result);
}
/**
\brief Set Control Register
\details Writes the given value to the Control Register.
\param [in] control Control Register value to set
*/
static inline void __set_CONTROL(uint32_t control)
{
__asm volatile ("MSR control, %0" : : "r" (control) : "memory");
}
/*@} end of CMSIS_Core_RegAccFunctions */
int main(void)
{
uint32_t control = __get_CONTROL();
assert(control >= 0x00000000);
__set_CONTROL(control);
return 0;
}
Considering this example input, the C parser crashes when trying to parse the end marker of a Doxygen group comment (/*@} end of CMSIS_Core_RegAccFunctions */ in line 34). The following error message is reported during a crash:
In this example, the C parser for the comments expects ACSL specifications and instead gets Doxygen group comments that violate the grammar of ACSL. Unfortunately, the parser cannot ignore the Doxygen group comments.
The text was updated successfully, but these errors were encountered:
We expect any comment starting with @ to be ACSL und thus try to parse the comment as such, see here.
It would be possible to add exceptions there, for this example to work, we could just ignore { and }.
We expect any comment starting with @ to be ACSL und thus try to parse the comment as such, see here. It would be possible to add exceptions there, for this example to work, we could just ignore { and }.
That's a good idea, but we first have to check that the braces cannot appear in ACSL.
In fact, the braces can also occur in ACSL comments. Here is an example from the ACSL standard (see 2.2.7 Structures, Unions and Arrays in logic), where parentheses are used in logic expressions for initialization and array access.
Fortunately, the braces are never at the beginning of a comment. We can therefore ignore the braces from Doxygen group comments at the beginning of each comment without restricting the ACSL syntax.
The current C parser crashes when there are Doxygen group comments in the C code. This issue can be reproduced with the latest version of Ultimate Automizer (0.2.4-dev-1ececfe with OpenJDK 11.0.23) using the following input:
Considering this example input, the C parser crashes when trying to parse the end marker of a Doxygen group comment (
/*@} end of CMSIS_Core_RegAccFunctions */
in line 34). The following error message is reported during a crash:In this example, the C parser for the comments expects ACSL specifications and instead gets Doxygen group comments that violate the grammar of ACSL. Unfortunately, the parser cannot ignore the Doxygen group comments.
The text was updated successfully, but these errors were encountered: