Automatic Name-Based Software Bug Detection via AST-Driven Static Analysis and Machine Learning

This paper presents a name analysis technique for statically typed languages to automatically classify and localize specific bugs in source code, eliminating the need for manually designed algorithms or heuristics.Name-based bug detection involves analyzing source code to detect potential bugs based on the names or labels used for variables, functions and other elements in the code.The Abstract Syntax Tree (AST) of the source code is utilized to automatically generate negative (buggy) samples due to the unavailability of a large set of negative samples.Approximately 720,000 code snippets of C language are collected from a large C code corpus and parsed into their corresponding ASTs using LibClang.Positive samples are extracted from AST and their contents are adjusted to generate negative samples.These samples are tokenized using a fine-tuned tokenizer and fed into a classification model for training to identify potential bugs.This paper describes techniques for detecting bugs related to swapped function arguments, wrong binary operators and wrong operator precedence, with a high F1 score between 83% and 95%.Moreover, the detection of new types of bugs can be easily accomplished by following similar steps taken in developing current bug detectors.The resulting system can automatically detect specific types of bugs in source code, serving as a tool that enhances code quality for software developers.

Authors

Publication Details

Journal
International Journal of Computer Applications
Published
2025-09-22
DOI
https://doi.org/10.5120/ijca2025925682
Primary Topic
Data Quality and Management
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Automatic Name-Based Software Bug Detection via AST-Driven Static Analysis and Machine Learning

Sujan Ghimire, Dinesh Baniya Kshatri, Sayandeep Acharya, Dipu Dahal et al.
International Journal of Computer Applications
Data Quality and Management
article

Automatic Name-Based Software Bug Detection via AST-Driven Static Analysis and Machine Learning

Sujan Ghimire, Dinesh Baniya Kshatri, Sayandeep Acharya, Dipu Dahal, Yunij Karki
article en

Abstract

This paper presents a name analysis technique for statically typed languages to automatically classify and localize specific bugs in source code, eliminating the need for manually designed algorithms or heuristics.Name-based bug detection involves analyzing source code to detect potential bugs based on the names or labels used for variables, functions and other elements in the code.The Abstract Syntax Tree (AST) of the source code is utilized to automatically generate negative (buggy) samples due to the unavailability of a large set of negative samples.Approximately 720,000 code snippets of C language are collected from a large C code corpus and parsed into their corresponding ASTs using LibClang.Positive samples are extracted from AST and their contents are adjusted to generate negative samples.These samples are tokenized using a fine-tuned tokenizer and fed into a classification model for training to identify potential bugs.This paper describes techniques for detecting bugs related to swapped function arguments, wrong binary operators and wrong operator precedence, with a high F1 score between 83% and 95%.Moreover, the detection of new types of bugs can be easily accomplished by following similar steps taken in developing current bug detectors.The resulting system can automatically detect specific types of bugs in source code, serving as a tool that enhances code quality for software developers.

International Journal of Computer ApplicationsVol. 187(39)
Openalex Percentile: Top 69%
Data Quality and Management
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.