跳到主要內容

臺灣博碩士論文加值系統

(44.212.94.18) 您好!臺灣時間:2023/12/11 23:50
字體大小: 字級放大   字級縮小   預設字形  
回查詢結果 :::

詳目顯示

: 
twitterline
研究生:王冠人
研究生(外文):WANG, KUAN-JEN
論文名稱:增強GCC以檢查MISRA-C 指標型別之轉換規則
論文名稱(外文):GCC enhancement for checking pointer typeconversions rules in MISRA-C
指導教授:陳鵬升陳鵬升引用關係
口試委員:涂嘉恒張榮貴陳鵬升
口試日期:2019-07-05
學位類別:碩士
校院名稱:國立中正大學
系所名稱:資訊工程研究所
學門:工程學門
學類:電資工程學類
論文種類:學術論文
論文出版年:2019
畢業學年度:107
語文別:英文
論文頁數:74
中文關鍵詞:MISRA-C checkerGCCCompilerAnalyzer
外文關鍵詞:MISRA-C checkerGCCCompilerAnalyzer
相關次數:
  • 被引用被引用:0
  • 點閱點閱:276
  • 評分評分:
  • 下載下載:32
  • 收藏至我的研究室書目清單書目收藏:0
MISRA-C 是一個軟體開發的標準,首次發表在1998 年。原先,其目
的為使語言標準化以及結構化。後來,MISRA-C 廣泛地使用在各種不同
的工業和軟體產業上,包含鐵路、航空、軍事和醫療產業。
在此篇論文中,我們透過修改GCC 內部來實作MISRA-C Checker;有
些規則已經被GCC 所偵測,但大部分的卻不是。因為GCC 包含了各種
不同的函式,我們無法針對每一個GCC 所定義的函式進行分析。因此.,
我們使用了一些方法,分析特定的函式來實作這些MISRA-C 的規則。總
計有26 個規則是我們可以檢查的,而在測試的benchmark 中,我們修改
後的編譯器可以完全支援24 個規則,而剩下的2 個則是部分支援的。
MISRA-C is a software development standard first published in 1998.
The intention was to provide a restricted subset of a standardized structured
language. MISRA-C has been adopted and used across a wide variety of industries
and applications including the rail, aerospace, military, and medical
sectors.
In this thesis, we implement the MISRA-C compliance checker based
on GCC compiler infrastructure. Some rules are already supported by GCC,
while the others are not. Since GCC contains numerous functions, we cannot
actually analyze all functions defined in GCC. Thus, we use some strategies
to figure out the functions which we should modify to implement the MISRAC
rules. There are 24 rules supported in our implementation. For the tested
benchmark programs, the modified GCC compiler can fully detect 24 rules
and the remaining 2 rules are partially supported.
1 Introduction 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Background 4
2.1 MISRA-C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 GCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Implementation with GCC . . . . . . . . . . . . . . . . . . . . 8

3 Approach 10
3.1 GCC data types . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2.1 fprintf and grep . . . . . . . . . . . . . . . . . . . . 13
3.2.2 debug_tree . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.3 inform . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2.4 TREE_TYPE and TREE_OPERAND . . . . . . . . . . . . . . 19

4 Implementation MISRA-C rules 24
4.1 Implementation: variable declaration . . . . . . . . . . . . . . 24
4.2 Implementation: type casting between objects . . . . . . . . . 38
4.3 Implementation: other rules . . . . . . . . . . . . . . . . . . . 53

5 Experiment 67
5.1 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.2 Evaluation result . . . . . . . . . . . . . . . . . . . . . . . . . 68

6 Conclusion 72
6.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
[1] Website, “Misra-c.” https://zh.wikipedia.org/wiki/MISRA_C, 2018.
[2] Website, “Pc-lint.” https://www.gimpel.com/html/links.htm.
[3] Website, “Misra-c 2012 example.” http://gimpel-online.com/
/cgi-bin/genPage.py?srcFile=misra3.c&cgiScript=analyseCode.
py&title=MISRA+C+2012+Example+%28C%29&intro=This+example+
shows+how+FlexeLint%2FPC-lint+addresses+certain+MISRA+C+
2012+guidelines.&compilerOption=online32.lnt+au-misra3.lnt+
lib-unmisra.lnt&includeOption={{quotedIncludeOption}}.
[4] Website, “Options to request or suppress warnings.” https://gcc.gnu.
org/onlinedocs/gcc/Warning-Options.html.
[5] Website, “Journey through gcc.” https://www.cse.iitb.ac.in/~uday/
gcc-mini-workshop/gcc-internals-1.pdf.
[6] Website, “Source tree organization.” https://www.airs.com/dnovillo/
200711-GCC-Internals/200711-GCC-Internals-1-condensed.pdf.
[7] Website, “An overview of gcc architecture.” https://en.
wikibooks.org/wiki/GNU_C_Compiler_Internals/GNU_C_Compiler_
Architecture.
[8] Website, “Gcc internal.” https://gcc.gnu.org/onlinedocs/gcc-7.3.
0/gccint/.
QRCODE
 
 
 
 
 
                                                                                                                                                                                                                                                                                                                                                                                                               
第一頁 上一頁 下一頁 最後一頁 top