A semiconductor device comprising: a first semiconductor substrate on which a given circuit is formed; a second semiconductor substrate pasted to the first semiconductor substrate; and through electrodes electrically connecting the first semiconductor substrate and the second semiconductor substrate to each other, wherein each of the through electrodes is formed such that a respective through-hole is opened through a protection diode structure formed in the first semiconductor substrate, an insulating film is deposited on a side wall of the through-hole, and an electrode material is then filled inside the through-hole in which the insulating film is deposited; wherein the respective through electrode is formed such that the through-hole is opened through the protection diode structure including a well region of one of a P type and an N type formed in the first semiconductor substrate and a diffusion layer of the other of the P type and the N type stacked and formed in the well region; wherein the diffusion layer is in a floating state having a potential that is not fixed; characterized in that the diffusion layer of the other of the P type and the N type stacked and formed in the well region is formed in a recessed portion of a shallow trench isolation; in that the protection diode structure is formed on a side of the shallow trench isolation facing away from the second semiconductor substrate; and in that a recessed portion of the shallow trench isolation is provided individually for each of the through electrodes, and in that the diffusion layer is formed between and in contact with the well region and the shallow trench isolation. a first semiconductor substrate on which a given circuit is formed; a second semiconductor substrate pasted to the first semiconductor substrate; and through electrodes electrically connecting the first semiconductor substrate and the second semiconductor substrate to each other, wherein each of the through electrodes is formed such that a respective through-hole is opened through a protection diode structure formed in the first semiconductor substrate, an insulating film is deposited on a side wall of the through-hole, and an electrode material is then filled inside the through-hole in which the insulating film is deposited; wherein the respective through electrode is formed such that the through-hole is opened through the protection diode structure including a well region of one of a P type and an N type formed in the first semiconductor substrate and a diffusion layer of the other of the P type and the N type stacked and formed in the well region; wherein the diffusion layer is in a floating state having a potential that is not fixed; characterized in that the diffusion layer of the other of the P type and the N type stacked and formed in the well region is formed in a recessed portion of a shallow trench isolation; in that the protection diode structure is formed on a side of the shallow trench isolation facing away from the second semiconductor substrate; and in that a recessed portion of the shallow trench isolation is provided individually for each of the through electrodes, and in that the diffusion layer is formed between and in contact with the well region and the shallow trench isolation.